time | Calls | line |
---|
| | 200 | function [pathstr, name, ext] = legacyPCExecution(file)
|
< 0.001 | 8 | 201 | if isstring(file)
|
< 0.001 | 4 | 202 | inputWasString = true;
|
< 0.001 | 4 | 203 | file = char(file);
|
< 0.001 | 4 | 204 | else
|
< 0.001 | 4 | 205 | inputWasString = false;
|
< 0.001 | 8 | 206 | end
|
< 0.001 | 8 | 207 | ext = '';
|
< 0.001 | 8 | 208 | pathstr = '';
|
< 0.001 | 8 | 209 | ind = find(file == '/' | file == '\', 1, 'last');
|
< 0.001 | 8 | 210 | if isempty(ind)
|
< 0.001 | 4 | 211 | ind = find(file == ':', 1, 'last');
|
< 0.001 | 4 | 212 | if ~isempty(ind)
|
| | 213 | pathstr = file(1:ind);
|
< 0.001 | 4 | 214 | end
|
< 0.001 | 4 | 215 | else
|
< 0.001 | 4 | 216 | if ind == 2 && (file(1) == '/' || file(1) == '\')
|
| | 217 | % Special case for UNC server
|
| | 218 | pathstr = file;
|
| | 219 | ind = length(file);
|
< 0.001 | 4 | 220 | else
|
< 0.001 | 4 | 221 | pathstr = file(1:ind-1);
|
< 0.001 | 4 | 222 | end
|
< 0.001 | 8 | 223 | end
|
< 0.001 | 8 | 224 | if isempty(ind)
|
< 0.001 | 4 | 225 | name = file;
|
< 0.001 | 4 | 226 | else
|
< 0.001 | 4 | 227 | if ~isempty(pathstr) && pathstr(end)== ':'
|
| | 228 | % Don't append to D: which is a volume path on windows
|
| | 229 | if length(pathstr) > 2
|
| | 230 | pathstr = [pathstr filesep];
|
| | 231 | elseif length(file) >= 3 && (file(3) == '/' || file(3) == '\')
|
| | 232 | pathstr = [pathstr file(3)];
|
| | 233 | end
|
< 0.001 | 4 | 234 | elseif isempty(deblank(pathstr))
|
| | 235 | pathstr = filesep;
|
< 0.001 | 4 | 236 | end
|
< 0.001 | 4 | 237 | name = file(ind+1:end);
|
< 0.001 | 8 | 238 | end
|
| | 239 |
|
< 0.001 | 8 | 240 | if ~isempty(name)
|
| | 241 | % Look for EXTENSION part
|
< 0.001 | 8 | 242 | ind = find(name == '.', 1, 'last');
|
| | 243 |
|
< 0.001 | 8 | 244 | if ~isempty(ind)
|
< 0.001 | 8 | 245 | ext = name(ind:end);
|
< 0.001 | 8 | 246 | name(ind:end) = [];
|
< 0.001 | 8 | 247 | end
|
< 0.001 | 8 | 248 | end
|
| | 249 |
|
< 0.001 | 8 | 250 | if inputWasString
|
< 0.001 | 4 | 251 | pathstr = string(pathstr);
|
< 0.001 | 4 | 252 | name = string(name);
|
< 0.001 | 4 | 253 | ext = string(ext);
|
< 0.001 | 8 | 254 | end
|
< 0.001 | 8 | 255 | end
|
Other subfunctions in this file are not included in this listing.