Skip to content

Commit bdb14ab

Browse files
committed
simplify
1 parent 85306ca commit bdb14ab

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

+stdlib/get_permissions.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
file (1,1) string
1414
end
1515

16-
perm = '';
17-
b = '';
1816

19-
if stdlib.exists(file)
20-
try
21-
perm = perm2char(filePermissions(file));
22-
b = 'native';
23-
catch e
24-
if e.identifier ~= "MATLAB:UndefinedFunction"
17+
try
18+
perm = perm2char(filePermissions(file));
19+
b = 'native';
20+
catch e
21+
switch e.identifier
22+
case 'MATLAB:UndefinedFunction'
23+
perm = perm2char(stdlib.legacy.file_attributes(file));
24+
b = 'legacy';
25+
case 'MATLAB:io:filesystem:filePermissions:CannotFindLocation'
26+
perm = '';
27+
b = '';
28+
otherwise
2529
rethrow(e)
26-
end
27-
28-
perm = perm2char(stdlib.legacy.file_attributes(file));
29-
b = 'legacy';
3030
end
3131
end
3232

0 commit comments

Comments
 (0)