Skip to content

Commit 96d02bd

Browse files
committed
create_symlink: catch admin error
1 parent 34de6f4 commit 96d02bd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

+stdlib/+native/create_symlink.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
ok = true;
66
catch e
77
switch e.identifier
8-
case {'MATLAB:io:filesystem:symlink:FileExists', 'MATLAB:io:filesystem:symlink:TargetNotFound'}, ok = false;
8+
% Some Windows R2025a need admin perms, some don't
9+
case {'MATLAB:io:filesystem:symlink:FileExists', ...
10+
'MATLAB:io:filesystem:symlink:TargetNotFound', ...
11+
'MATLAB:io:filesystem:symlink:NeedsAdminPerms'}
12+
ok = false;
913
otherwise, rethrow(e)
1014
end
1115
end

+stdlib/Backend.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@
8585

8686
switch functionName
8787
case 'create_symlink'
88-
if stdlib.matlabOlderThan('R2024b') || (ispc() && stdlib.matlabOlderThan('R2025a'))
88+
% Some Windows R2025a give error 'MATLAB:io:filesystem:symlink:NeedsAdminPerms'
89+
% 25.1.0.2973910 (R2025a) Update 1 gave this error for example.
90+
if stdlib.matlabOlderThan('R2024b') || ispc()
8991
continue
9092
end
9193
case {'is_symlink', 'read_symlink'}

0 commit comments

Comments
 (0)