Skip to content

Commit 0dc42e3

Browse files
committed
get_permissions: simplify
1 parent e2add18 commit 0dc42e3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

+stdlib/get_permissions.m

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@
1515
if strcmp(e.identifier, "MATLAB:io:filesystem:filePermissions:CannotFindLocation")
1616
return
1717
elseif strcmp(e.identifier, "Octave:undefined-function")
18-
s = stat(f);
19-
if ~isempty(s)
20-
p = s.modestr;
18+
try %#ok<TRYNC>
19+
p = stat(f).modestr;
2120
end
2221
return
23-
elseif ~strcmp(e.identifier, "MATLAB:UndefinedFunction")
22+
elseif strcmp(e.identifier, "MATLAB:UndefinedFunction")
23+
v = file_attributes(f);
24+
if isempty(v), return, end
25+
else
2426
rethrow(e)
2527
end
26-
27-
v = file_attributes(f);
28-
if isempty(v), return, end
2928
end
3029

3130
p = perm2char(v);

0 commit comments

Comments
 (0)