Skip to content

Commit 577bddc

Browse files
committed
read_symlink: more fallback
1 parent 653833e commit 577bddc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

+stdlib/read_symlink.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
case "MATLAB:UndefinedFunction"
2020
if ~stdlib.is_symlink(p), return, end
2121

22-
if stdlib.has_dotnet() && stdlib.dotnet_api() >= 6
22+
if stdlib.has_python()
23+
% https://docs.python.org/3/library/pathlib.html#pathlib.Path.readlink
24+
r = string(py.str(py.pathlib.Path(p).readlink()));
25+
elseif stdlib.has_dotnet() && stdlib.dotnet_api() >= 6
2326
r = System.IO.FileInfo(p).LinkTarget;
2427
elseif stdlib.has_java()
2528
% must be absolute path

buildfile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function build_exe(context)
277277
srcs{end+1} = ["src/is_symlink.cpp", win, sym];
278278
end
279279

280-
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_dotnet() || stdlib.dotnet_api() < 6) || build_all
280+
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_java() && ~stdlib.has_python() && ~stdlib.has_dotnet() || stdlib.dotnet_api() < 6) || build_all
281281
srcs{end+1} = ["src/read_symlink.cpp", win, sym];
282282
end
283283

0 commit comments

Comments
 (0)