Skip to content

Commit 6357309

Browse files
committed
show that canonical resolves short name
1 parent 9746145 commit 6357309

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

+stdlib/+fileio/windows_shortname.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
%
1010

1111

12-
arguments
12+
arguments (Input)
1313
p (1,1) string
1414
end
15+
arguments (Output)
16+
short (1,1) string
17+
end
1518

1619
assert(ispc, 'Only available on Windows')
1720

+stdlib/+test/TestWindowsCOM.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ function test_shortname(tc)
66

77
tc.assumeTrue(ispc, "Windows only")
88

9-
test_file = fullfile(getenv("LocalAppData"), 'Microsoft\WindowsApps\notepad.exe');
9+
test_file = string(fullfile(getenv("LocalAppData"), 'Microsoft\WindowsApps\notepad.exe'));
1010
tc.assumeTrue(isfile(test_file))
1111

1212
short = stdlib.fileio.windows_shortname(test_file);
1313

1414
tc.verifyTrue(endsWith(short, 'notepad.exe'), "Short name should end with 'notepad.exe'")
1515
tc.verifyTrue(contains(short, "MICROS~1"))
1616

17-
end
17+
tc.verifyEqual(stdlib.canonical(short), test_file)
1818

1919
end
2020

2121
end
2222

23+
end

+stdlib/canonical.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
% subsystem, but are sometimes still valid--so return
77
% unmodified path if this occurs.
88
%
9+
% This also resolves Windows short paths to full long paths.
10+
%
911
%%% Inputs
1012
% * p: path to make absolute
1113
%%% Outputs

0 commit comments

Comments
 (0)