File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11%% SAMEPATH is path the same
2+ % optional: java
23%
34% true if inputs resolve to same path.
45% Both paths must exist.
1617 path2 {mustBeTextScalar }
1718end
1819
19- % simpler our way than
20- % https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/Files.html#isSameFile(java.nio.file.Path,java.nio.file.Path)
21-
2220y = stdlib .exists(path1 ) && stdlib .exists(path2 );
2321
2422if ~y , return ; end
3028 y = e1 == 0 && e2 == 0 && ...
3129 r1.ino == r2 .ino && r1 .dev == r2 .dev ;
3230
31+ elseif stdlib .has_java()
32+ % https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/nio/file/Files.html#isSameFile(java.nio.file.Path,java.nio.file.Path)
33+
34+ y = java .nio .file .Files .isSameFile(javaPathObject(path1 ), javaPathObject(path2 ));
35+
3336else
37+
3438 y = strcmp(stdlib .canonical(path1 ), stdlib .canonical(path2 ));
39+
3540end
3641
3742% !assert(samepath(".", "."))
You can’t perform that action at this time.
0 commit comments