File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change 1818arguments
1919 p (1 ,1 ) string
2020 expand_tilde (1 ,1 ) logical = true
21- use_java (1 ,1 ) logical = true
21+ use_java (1 ,1 ) logical = false
2222end
2323
2424if expand_tilde
3333end
3434
3535e = stdlib .exists(c );
36- if ~e && ~stdlib .has_java
37- % _canonicalizepath errors if path does not exist
38- return
39- end
4036
4137if ~stdlib .is_absolute(c )
4238 if e
43- % workaround Java/Matlab limitations
44- c = stdlib .join(pwd , c );
39+ if ~expand_tilde && ~use_java && startsWith(c , " ~" )
40+ c = stdlib .normalize(c , use_java );
41+ return
42+ else
43+ % workaround Java/Matlab limitations
44+ c = stdlib .join(pwd , c );
45+ end
4546 else
4647 % for non-existing path, return normalized relative path
4748 % like C++ filesystem weakly_canonical()
5051 end
5152end
5253
53- if use_java && stdlib .has_java
54- % we use has_java check because default is use_java
54+ if use_java
5555 c = java .io .File(c ).getCanonicalPath();
56- else
57- % similar benchmark time as java method
56+ elseif e
57+ % errors if path does not exist. Errors on leading ~
5858 c = builtin(' _canonicalizepath' , c );
59+ else
60+ c = stdlib .normalize(c , use_java );
5961end
6062
6163c = stdlib .posix(c );
You can’t perform that action at this time.
0 commit comments