Skip to content

Commit 7a27843

Browse files
committed
is_{exe,readable,writable}: streamline
1 parent 9b21d1c commit 7a27843

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

+stdlib/is_exe.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@
77
p (1,1) string
88
end
99

10-
ok = false;
11-
if ~stdlib.exists(p), return, end
12-
1310
a = file_attributes(p);
14-
if isempty(a), return, end
1511

16-
ok = a.UserExecute || a.GroupExecute || a.OtherExecute;
12+
ok = ~isempty(a) && (a.UserExecute || a.GroupExecute || a.OtherExecute);
1713

1814
end
1915

+stdlib/is_readable.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
p (1,1) string
88
end
99

10-
ok = false;
11-
1210
a = file_attributes(p);
13-
if isempty(a), return, end
1411

15-
ok = a.UserRead || v.GroupRead || v.OtherRead;
12+
ok = ~isempty(a) && (a.UserRead || v.GroupRead || v.OtherRead);
1613

1714
end
1815

+stdlib/is_writable.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
p (1,1) string
88
end
99

10-
ok = false;
11-
1210
a = file_attributes(p);
13-
if isempty(a), return, end
1411

15-
ok = a.UserWrite || v.GroupWrite || v.OtherWrite;
12+
ok = ~isempty(a) && (a.UserWrite || v.GroupWrite || v.OtherWrite);
1613

1714
end
1815

0 commit comments

Comments
 (0)