Skip to content

Commit 9fdc343

Browse files
committed
windows:get_permissions: executable
1 parent e5444f7 commit 9fdc343

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

+stdlib/get_permissions.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,16 @@
4646
if v.UserWrite, p(2) = 'w'; end
4747
end
4848

49-
if v.UserExecute, p(3) = 'x'; end
49+
% on Windows, any readable file has executable permission
50+
if ispc
51+
if p(1) == 'r'
52+
p(3) = 'x';
53+
end
54+
else
55+
if v.UserExecute, p(3) = 'x'; end
56+
end
57+
58+
% Windows doesn't have these permissions
5059

5160
try
5261
if v.GroupRead, p(4) = 'r'; end
@@ -58,6 +67,7 @@
5867
catch e
5968
if ~strcmp(e.identifier, "MATLAB:nologicalnan") && ...
6069
~strcmp(e.identifier, "MATLAB:nonExistentField") && ...
70+
~strcmp(e.identifier, "MATLAB:noSuchMethodOrField") && ...
6171
~strcmp(e.message, "invalid conversion from NaN to logical")
6272
rethrow(e)
6373
end

0 commit comments

Comments
 (0)