Skip to content

Commit 81b618c

Browse files
committed
dedupe posix
1 parent fd93a91 commit 81b618c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

+stdlib/parent.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
if use_java
1010
% java is about 10x slower than intrinsic
11-
p = string(java.io.File(p).getParent());
11+
p = java.io.File(p).getParent();
1212
else
1313
% have to drop_slash on input to get expected parent path
1414
p = strip(stdlib.posix(p), "right", "/");

+stdlib/read_symlink.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
r = stdlib.absolute(p, string.empty, false, true);
1818

1919
% https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/Files.html#readSymbolicLink(java.nio.file.Path)
20-
r = stdlib.posix(...
21-
java.nio.file.Files.readSymbolicLink(java.io.File(r).toPath()));
20+
t = java.nio.file.Files.readSymbolicLink(java.io.File(r).toPath());
2221

2322
else
2423
[ok, t] = isSymbolicLink(p);
25-
if ok
26-
r = stdlib.posix(t);
27-
end
24+
if ~ok, return, end
25+
end
26+
27+
r = stdlib.posix(t);
28+
2829
end

0 commit comments

Comments
 (0)