Skip to content

Commit

Permalink
join: correct java=true case
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Dec 11, 2024
1 parent 033aa36 commit 62e50c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion +stdlib/join.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
if stdlib.isoctave()
p = javaObject("java.io.File", b).toPath().resolve(o).toString();
elseif use_java
p = java.io.File(b).toPath().resolve(o);
p = string(java.io.File(b).toPath().resolve(o));
else

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

end

%!assert(join("", ""), "")
%!assert(join("", "b"), "b")
%!assert(join("a", ""), "a")
%!assert(join("a", "b"), "a/b")
%!assert(join("a", "/b/c"), "/b/c")
3 changes: 2 additions & 1 deletion test/TestFilePure.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
{"a/b/../", "c/d/../", "a/b/../c/d/.."}, ...
{"a/b", "..", "a/b/.."}, ...
{"a/b", "c/d", "a/b/c/d"}, ...
{"ab/cd", "/ef", "/ef"} ...
{"ab/cd", "/ef", "/ef"}, ...
{matlabroot, "bin", matlabroot + "/bin"}
}

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

0 comments on commit 62e50c8

Please sign in to comment.