Skip to content

Commit 653833e

Browse files
committed
create_symlink: more fallback
1 parent 9b22540 commit 653833e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

+stdlib/create_symlink.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
%% CREATE_SYMLINK create symbolic link
2-
% optional: mex
32
%
43
%%% Inputs
54
% * target: path to link to
@@ -26,7 +25,10 @@
2625
% Matlab Java doesn't recognize the optional argument omitted.
2726
% see example/Filesystem.java for this working in plain Java.
2827
% see example/javaCreateSymbolicLink.m for a non-working attempt in Matlab.
29-
if stdlib.has_dotnet() && stdlib.dotnet_api() >= 6
28+
if stdlib.has_python()
29+
py.pathlib.Path(link).symlink_to(target);
30+
ok = true;
31+
elseif stdlib.has_dotnet() && stdlib.dotnet_api() >= 6
3032
% https://learn.microsoft.com/en-us/dotnet/api/system.io.file.createsymboliclink
3133
System.IO.File.CreateSymbolicLink(link, target);
3234
ok = true;

buildfile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function build_exe(context)
281281
srcs{end+1} = ["src/read_symlink.cpp", win, sym];
282282
end
283283

284-
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_dotnet() || stdlib.dotnet_api() < 6) || build_all
284+
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_python() && ~stdlib.has_dotnet() || stdlib.dotnet_api() < 6) || build_all
285285
% so that we don't need to run matlab AsAdmin on Windows
286286
srcs{end+1} = ["src/create_symlink.cpp", win, sym];
287287
end

0 commit comments

Comments
 (0)