File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11%% DISK_CAPACITY disk total capacity (bytes)
2- % optional: mex
32%
43% example: stdlib.disk_capacity('/')
54
Original file line number Diff line number Diff line change 11%% IS_SYMLINK is path a symbolic link
2- % optional: mex
32
43function ok = is_symlink(p )
54arguments
1514 if stdlib .dotnet_api() >= 6
1615 ok = ~isempty(System .IO .FileInfo(p ).LinkTarget);
1716 else
18- attr = string(System .IO .File .GetAttributes(p ).ToString());
19- % https://learn.microsoft.com/en-us/dotnet/api/system.io.fileattributes
20- % ReparsePoint is for Linux, macOS, and Windows
21- ok = contains(attr , ' ReparsePoint' );
17+ attr = string(System .IO .File .GetAttributes(p ).ToString());
18+ % https://learn.microsoft.com/en-us/dotnet/api/system.io.fileattributes
19+ % ReparsePoint is for Linux, macOS, and Windows
20+ ok = contains(attr , ' ReparsePoint' );
2221 end
2322 elseif stdlib .has_java()
2423 ok = java .nio .file .Files .isSymbolicLink(javaPathObject(stdlib .absolute(p )));
24+ elseif stdlib .has_python()
25+ ok = py .pathlib .Path(p ).is_symlink();
2526 else
26- rethrow( e )
27+ ok = logical . empty ;
2728 end
2829 case " Octave:undefined-function"
2930 % use lstat() to work with a broken symlink, like Matlab isSymbolicLink
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ function build_exe(context)
273273srcs{end + 1 } = " src/disk_capacity.cpp" ;
274274end
275275
276- if (isMATLABReleaseOlderThan(" R2024b" ) && ~stdlib .has_dotnet()) || build_all
276+ if (isMATLABReleaseOlderThan(" R2024b" ) && ~stdlib .has_dotnet() && ~ stdlib .has_java() && ~ stdlib .has_python() ) || build_all
277277srcs{end + 1 } = [" src/is_symlink.cpp" , win , sym ];
278278end
279279
You can’t perform that action at this time.
0 commit comments