Skip to content

Commit 3aaf981

Browse files
committed
read_symlink: more uniform behavior
1 parent 0b90540 commit 3aaf981

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

+stdlib/read_symlink.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121

2222
if stdlib.has_python()
2323
% https://docs.python.org/3/library/pathlib.html#pathlib.Path.readlink
24-
r = string(py.str(py.pathlib.Path(p).readlink()));
24+
r = string(py.os.readlink(p));
25+
if ispc() && startsWith(r, '\\?\')
26+
r = extractAfter(r, '\\?\');
27+
end
2528
elseif stdlib.dotnet_api() >= 6
2629
r = System.IO.FileInfo(p).LinkTarget;
2730
elseif stdlib.has_java()

test/TestSymlink.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ function test_read_symlink(tc)
4343
tc.verifyEmpty(stdlib.read_symlink(tc.target))
4444

4545

46-
t = stdlib.read_symlink(tc.link);
46+
link_read = stdlib.read_symlink(tc.link);
4747

4848
targ = string(tc.target);
4949

50-
tc.verifyEqual(targ, t)
50+
tc.verifyEqual(link_read, targ)
5151

5252
end
5353

0 commit comments

Comments
 (0)