File tree Expand file tree Collapse file tree 5 files changed +22
-19
lines changed Expand file tree Collapse file tree 5 files changed +22
-19
lines changed Original file line number Diff line number Diff line change 88end
99% need to have string array type for p(:)
1010
11- if ~ stdlib .isoctave() && ~isMATLABReleaseOlderThan( ' R2025a ' )
11+ try
1212 if isunix
1313 props = [" UserExecute" , " GroupExecute" , " OtherExecute" ];
1414 else
1515 props = " Readable" ;
1616 end
1717 t = getPermissions(filePermissions(p ), props );
1818 ok = isfile(p(: )) & any(t{: ,: }, 2 );
19- else
20- a = file_attributes_legacy(p );
21- ok = isfile(p ) && (a .UserExecute || a .GroupExecute || a .OtherExecute );
19+ catch e
20+ switch e .identifier
21+ case {' MATLAB:UndefinedFunction' , ' Octave:undefined-function' }
22+ a = file_attributes_legacy(p );
23+ ok = isfile(p ) && (a .UserExecute || a .GroupExecute || a .OtherExecute );
24+ end
2225end
2326
2427end
Original file line number Diff line number Diff line change 22
33function ok = is_readable(p )
44
5- if ~ stdlib .isoctave() && ~isMATLABReleaseOlderThan( ' R2025a ' )
5+ try
66 props = " Readable" ;
77 if isunix
88 props = [props , " GroupRead" , " OtherRead" ];
99 end
1010 t = getPermissions(filePermissions(p ), props );
1111 ok = any(t{: ,: }, 2 );
12- else
13- a = file_attributes_legacy(p );
14- ok = a .UserRead || a .GroupRead || a .OtherRead ;
12+ catch e
13+ switch e .identifier
14+ case {' MATLAB:UndefinedFunction' , ' Octave:undefined-function' }
15+ a = file_attributes_legacy(p );
16+ ok = a .UserRead || a .GroupRead || a .OtherRead ;
17+ end
1518end
1619
20+ end
1721% !assert (is_readable('is_readable.m'))
Original file line number Diff line number Diff line change 22% optional: mex
33
44function ok = is_symlink(p )
5- arguments
6- p {mustBeTextScalar }
7- end
8-
95
106try
117 ok = isSymbolicLink(p );
Original file line number Diff line number Diff line change 22% e.g. https://example.invalid is true
33
44function y = is_url(s )
5- arguments
6- s {mustBeTextScalar }
7- end
85
96y = startsWith(s , alphanumericsPattern + " ://" );
107
Original file line number Diff line number Diff line change 22
33function ok = is_writable(p )
44
5- if ~ stdlib .isoctave() && ~isMATLABReleaseOlderThan( ' R2025a ' )
5+ try
66 props = " Writable" ;
77 if isunix
88 props = [props , " GroupWrite" , " OtherWrite" ];
99 end
1010 t = getPermissions(filePermissions(p ), props );
1111 ok = any(t{: ,: }, 2 );
12- else
13- a = file_attributes_legacy(p );
14- ok = a .UserWrite || a .GroupWrite || a .OtherWrite ;
12+ catch e
13+ switch e .identifier
14+ case {' MATLAB:UndefinedFunction' , ' Octave:undefined-function' }
15+ a = file_attributes_legacy(p );
16+ ok = a .UserWrite || a .GroupWrite || a .OtherWrite ;
17+ end
1518end
1619
1720end
You can’t perform that action at this time.
0 commit comments