File tree Expand file tree Collapse file tree 4 files changed +24
-13
lines changed Expand file tree Collapse file tree 4 files changed +24
-13
lines changed Original file line number Diff line number Diff line change 11function c = canonical(file , strict )
2+ arguments
3+ file string
4+ strict (1 ,1 ) logical = false
5+ end
6+
7+ rp = matlab .io .internal .filesystem .resolvePath(file );
8+ c = string({rp .ResolvedPath });
29
3- if stdlib .strempty(file )
4- c = " " ;
10+ if strict
511 return
612end
713
8- p = matlab .io .internal .filesystem .resolvePath(file );
9- c = p .ResolvedPath ;
10-
11- if ~strict && stdlib .strempty(c )
12- c = string(stdlib .normalize(file ));
14+ for i = 1 : numel(file )
15+ if strlength(c(i )) == 0 && strlength(file(i )) > 0
16+ c(i ) = stdlib .normalize(file(i ));
17+ end
1318end
1419
1520end
Original file line number Diff line number Diff line change 11function n = normalize(p )
2+ arguments
3+ p (1 ,1 ) string
4+ end
25
3- n = stdlib .posix(string( p ) );
6+ n = stdlib .posix(p );
47
58uncslash = ispc() && startsWith(n , " //" );
69
Original file line number Diff line number Diff line change 1414
1515function c = canonical(p , strict , backend )
1616arguments
17- p { mustBeTextScalar }
17+ p string
1818 strict (1 ,1 ) logical = false
1919 backend (1 ,: ) string = [" native" , " legacy" ]
2020end
2121
22- fun = hbackend(backend , " canonical" , ' R2024a' );
23-
24- c = fun(p , strict );
22+ if isscalar(p )
23+ fun = hbackend(backend , " canonical" , ' R2024a' );
24+ c = fun(p , strict );
25+ else
26+ c = stdlib .native .canonical(p , strict );
27+ end
2528
2629end
Original file line number Diff line number Diff line change 1010
1111function r = resolve(p )
1212arguments
13- p { mustBeTextScalar }
13+ p string
1414end
1515
1616r = stdlib .canonical(stdlib .absolute(p ));
You can’t perform that action at this time.
0 commit comments