Skip to content

Commit 7f0e805

Browse files
committed
simplify
1 parent ab93278 commit 7f0e805

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

+stdlib/normalize.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616

1717

1818
if stdlib.isoctave()
19-
n = stdlib.posix(javaObject("java.io.File", p).toPath().normalize().toString());
19+
o = javaObject("java.io.File", p).toPath().normalize();
20+
n = jPosix(o);
2021
elseif use_java
21-
n = stdlib.posix(java.io.File(p).toPath().normalize().toString());
22+
o = java.io.File(p).toPath().normalize();
23+
n = jPosix(o);
2224
else
2325

24-
n = stdlib.posix(string(p));
26+
n = stdlib.posix(p);
2527

2628
% use split to remove /../ and /./ and duplicated /
2729
parts = split(n, '/');

+stdlib/relative_to.m

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
end
3434

3535
try
36-
r = b.relativize(o).toString();
36+
r = jPosix(b.relativize(o));
3737
catch e
3838
r = "";
3939
if stdlib.isoctave()
@@ -47,12 +47,6 @@
4747
end
4848
end
4949

50-
if isstring(b1)
51-
r = string(r);
52-
end
53-
54-
r = stdlib.posix(r);
55-
5650
end
5751

5852
%!assert(relative_to("/a/b", "/a/b"), ".")

0 commit comments

Comments
 (0)