Skip to content

Commit 62e50c8

Browse files
committed
join: correct java=true case
1 parent 033aa36 commit 62e50c8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

+stdlib/join.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
if stdlib.isoctave()
3333
p = javaObject("java.io.File", b).toPath().resolve(o).toString();
3434
elseif use_java
35-
p = java.io.File(b).toPath().resolve(o);
35+
p = string(java.io.File(b).toPath().resolve(o));
3636
else
3737

3838
if startsWith(o, "/") || (ispc && stdlib.is_absolute(o))
@@ -45,3 +45,9 @@
4545
end
4646

4747
end
48+
49+
%!assert(join("", ""), "")
50+
%!assert(join("", "b"), "b")
51+
%!assert(join("a", ""), "a")
52+
%!assert(join("a", "b"), "a/b")
53+
%!assert(join("a", "/b/c"), "/b/c")

test/TestFilePure.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
{"a/b/../", "c/d/../", "a/b/../c/d/.."}, ...
2727
{"a/b", "..", "a/b/.."}, ...
2828
{"a/b", "c/d", "a/b/c/d"}, ...
29-
{"ab/cd", "/ef", "/ef"} ...
29+
{"ab/cd", "/ef", "/ef"}, ...
30+
{matlabroot, "bin", matlabroot + "/bin"}
3031
}
3132

3233
p_suffix = {{"", ""}, {"/a/b/c", ""}, {"/a/b/c/", ""}, {"a/b/c.txt", ".txt"}, {"a/b/c.txt.gz", ".gz"}, {".stat", ".stat"}, {".stat.txt", ".txt"}}

0 commit comments

Comments
 (0)