Skip to content

Commit a62de27

Browse files
committed
join: do not posix()
1 parent 4ba56e6 commit a62de27

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

+stdlib/join.m

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@
66
other {mustBeTextScalar}
77
end
88

9+
if stdlib.is_absolute(other)
910

10-
b = stdlib.posix(base);
11-
o = stdlib.posix(other);
11+
p = other;
1212

13-
if startsWith(o, '/') || (ispc() && stdlib.is_absolute(o))
14-
p = o;
15-
return
16-
end
13+
elseif strlength(base)
1714

18-
p = b;
19-
if strlength(o)
20-
if endsWith(p, '/')
21-
p = strcat(p, o);
22-
elseif strlength(p)
23-
p = strcat(p, '/', o);
15+
if strlength(other)
16+
if endsWith(base, '/')
17+
p = strcat(base, other);
18+
else
19+
p = strcat(base, '/', other);
20+
end
2421
else
25-
p = o;
22+
p = base;
2623
end
24+
25+
else
26+
27+
p = other;
28+
2729
end
2830

2931
end

test/TestJoin.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{"a/b", "c/d", "a/b/c/d"}, ...
1414
{"ab/cd", "/ef", "/ef"}, ...
1515
{stdlib.homedir(), "", stdlib.homedir()}, ...
16-
{matlabroot, "bin", stdlib.posix(matlabroot + "/bin")}
16+
{matlabroot, "bin", matlabroot + "/bin"}
1717
}
1818
end
1919

0 commit comments

Comments
 (0)