File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1- function c = canonical(p , expand_tilde )
1+ function c = canonical(p , expand_tilde , use_java )
22%% canonical(p)
33% If exists, canonical absolute path is returned
44% if path does not exist, normalized relative path is returned
1818arguments
1919 p (1 ,1 ) string
2020 expand_tilde (1 ,1 ) logical = true
21+ use_java (1 ,1 ) logical = true
2122end
2223
2324if expand_tilde
3233end
3334
3435if ~stdlib .is_absolute(c )
35- if isfile( c ) || isfolder (c )
36+ if stdlib .exists (c )
3637 % workaround Java/Matlab limitations
3738 c = stdlib .join(pwd , c );
3839 else
4344 end
4445end
4546
46- % similar benchmark time as java method
47- % REQUIRES path to exist, while java method does not.
48- % c = builtin('_canonicalizepath', c);
47+ if use_java
48+ c = java .io .File(c ).getCanonicalPath();
49+ else
50+ % similar benchmark time as java method
51+ % REQUIRES path to exist, while java method does not.
52+ c = builtin(' _canonicalizepath' , c );
53+ end
4954
50- c = stdlib .posix(java . io .File( c ).getCanonicalPath() );
55+ c = stdlib .posix(c );
5156
5257end % function
You can’t perform that action at this time.
0 commit comments