Skip to content

Commit b0d6851

Browse files
committed
doc
1 parent 45882fc commit b0d6851

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

+stdlib/+legacy/set_permissions.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
function ok = set_permissions(file, readable, writable, executable)
2+
%% LEGACY.SET_PERMISSIONS set file permissions
3+
%
4+
% it is strongly recommended to use filePermissions instead, as setting permissions via fileattrib
5+
% often fails
26

37
mode = '';
48
% mode is space-delimited
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
%% FILEATTRIBCOMPATIBLE fileattrib required char until R2018a; this provides a seamless fallback
2-
31
function [s, r, id] = fileAttribCompatible(file)
2+
%% FILEATTRIBCOMPATIBLE fileattrib required char until R2018a; this provides a seamless fallback
3+
%
4+
% despite fileattrib being deprecated in R2026a, it is not scheduled for removal.
45

56
% need stdlib.strempty for Matlab < R2020b
67
if stdlib.strempty(file)
78
r = struct([]);
89
s = 0;
910
id = 'MATLAB:FILEATTRIB:CannotFindFile';
10-
return
11+
else
12+
% char() for Matlab < R2018a
13+
[s, r, id] = fileattrib(char(file));
1114
end
1215

13-
% char() for Matlab < R2018a
14-
[s, r, id] = fileattrib(char(file));
15-
1616
end

0 commit comments

Comments
 (0)