Skip to content

Commit 8fb5a17

Browse files
committed
example
example closer to code
1 parent 29c6509 commit 8fb5a17

4 files changed

Lines changed: 7 additions & 39 deletions

File tree

example/+native/is_exe.m

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@
1515
props = "Readable";
1616
end
1717

18-
try
19-
y = getPermissions(filePermissions(file), props);
20-
catch e
21-
switch e.identifier
22-
case 'MATLAB:io:filesystem:filePermissions:CannotFindLocation'
23-
y = logical([]);
24-
otherwise
25-
rethrow(e)
26-
end
27-
end
18+
y = getPermissions(filePermissions(file), props);
2819

2920
end

example/+native/is_readable.m

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@
88
props = [props, "GroupRead", "OtherRead"];
99
end
1010

11-
try
12-
y = getPermissions(filePermissions(file), props);
13-
catch e
14-
switch e.identifier
15-
case 'MATLAB:io:filesystem:filePermissions:CannotFindLocation'
16-
y = logical([]);
17-
otherwise
18-
rethrow(e)
19-
end
20-
end
11+
y = getPermissions(filePermissions(file), props);
2112

2213
end

example/+native/is_writable.m

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
props = [props, "GroupWrite", "OtherWrite"];
99
end
1010

11-
try
12-
y = getPermissions(filePermissions(file), props);
13-
catch e
14-
switch e.identifier
15-
case 'MATLAB:io:filesystem:filePermissions:CannotFindLocation'
16-
y = logical([]);
17-
otherwise
18-
rethrow(e)
19-
end
20-
end
21-
11+
y = getPermissions(filePermissions(file), props);
2212

2313
end

example/+perl/device.m

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
%% PERL.DEVICE filesystem device index of path
22

3-
function [r, cmd] = device(file)
3+
function [i, cmd] = device(file)
44

5-
r = uint64([]);
5+
i = missing;
66

77
exe = stdlib.perl_exe();
88
if stdlib.strempty(exe)
@@ -13,13 +13,9 @@
1313

1414
cmd = sprintf('"%s" -e %s "%s"', exe, c, file);
1515

16-
[s, r] = system(cmd);
16+
[s, i] = system(cmd);
1717
if s == 0
18-
r = str2double(r);
19-
else
20-
r = [];
18+
i = uint64(str2double(i));
2119
end
2220

23-
r = uint64(r);
24-
2521
end

0 commit comments

Comments
 (0)