Skip to content

Commit e1643a2

Browse files
committed
streamline
1 parent 36b749c commit e1643a2

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

+stdlib/set_permissions.m

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,21 @@
1919
executable (1,1) {mustBeInteger}
2020
end
2121

22-
b = '';
23-
24-
if ~stdlib.exists(file)
25-
ok = false;
26-
return
27-
end
2822

2923
try
3024
ok = stdlib.native.set_permissions(file, readable, writable, executable);
3125
b = 'native';
3226
catch e
33-
if e.identifier ~= "MATLAB:UndefinedFunction"
34-
rethrow(e)
27+
switch e.identifier
28+
case 'MATLAB:UndefinedFunction'
29+
ok = stdlib.legacy.set_permissions(file, readable, writable, executable);
30+
b = 'legacy';
31+
case 'MATLAB:io:filesystem:filePermissions:CannotFindLocation'
32+
ok = false;
33+
b = '';
34+
otherwise
35+
rethrow(e)
3536
end
36-
37-
ok = stdlib.legacy.set_permissions(file, readable, writable, executable);
38-
b = 'legacy';
3937
end
4038

4139
end

0 commit comments

Comments
 (0)