File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1+ function ok = is_symlink(p )
2+
3+ if ispc()
4+ [s , m ] = system(sprintf(' pwsh -command "(Get-Item -Path %s ).Attributes"' , p ));
5+ ok = s == 0 && contains(m , ' ReparsePoint' );
6+ else
7+ [s , ~ ] = system(sprintf(' test -L %s ' , p ));
8+ ok = s == 0 ;
9+ end
10+
11+ end
Original file line number Diff line number Diff line change 77
88try
99 ok = isSymbolicLink(p );
10+ return
1011catch e
1112 switch e .identifier
1213 case " MATLAB:UndefinedFunction"
1617 ok = java .nio .file .Files .isSymbolicLink(javaPathObject(stdlib .absolute(p )));
1718 elseif stdlib .has_python()
1819 ok = stdlib .python .is_symlink(p );
19- elseif isunix()
20- ok = system(sprintf(' test -L %s ' , p )) == 0 ;
21- elseif ispc()
22- [s , m ] = system(sprintf(' pwsh -command "(Get-Item -Path %s ).Attributes"' , p ));
23- ok = s == 0 && contains(m , ' ReparsePoint' );
2420 end
2521 case " Octave:undefined-function"
2622 % use lstat() to work with a broken symlink, like Matlab isSymbolicLink
3026 end
3127end
3228
29+ if ~ok
30+ ok = stdlib .sys .is_symlink(p );
31+ end
32+
3333end
3434
3535
You can’t perform that action at this time.
0 commit comments