Skip to content

Commit cce54b1

Browse files
committed
is_mount: correct shell syntax
1 parent c6ee369 commit cce54b1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

+stdlib/+sys/is_mount.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
end
88

99
if ispc()
10-
if ismember(filepath, ["/", "\"]) || ...
11-
(endsWith(filepath, ["/", filesep]) && isfolder(filepath) && filepath == stdlib.root(filepath))
10+
fs = {'/', filesep};
11+
if ismember(filepath, fs) || ...
12+
(endsWith(filepath, fs) && ...
13+
isfolder(filepath) && ...
14+
strcmp(filepath, stdlib.root(filepath)))
1215
y = true;
1316
return
1417
end
1518
cmd = sprintf('pwsh -c "(Get-Item -Path ''%s'').Attributes.ToString().Contains(''ReparsePoint'')"', filepath);
1619
elseif ismac()
17-
if filepath == "/"
20+
if strcmp(filepath, '/')
1821
y = true;
1922
return
2023
end
21-
cmd = sprintf('[ $(stat -f %%d "%s") != $(stat -f %%d "%s")]', ...
24+
cmd = sprintf('[ $(stat -f %%d "%s") != $(stat -f %%d "%s") ]', ...
2225
filepath, stdlib.parent(filepath));
2326
else
2427
cmd = sprintf('mountpoint -q "%s"', filepath);
@@ -27,7 +30,7 @@
2730
[s, m] = system(cmd);
2831

2932
if ispc()
30-
y = s == 0 && m == "True";
33+
y = s == 0 && strcmp(m, 'True');
3134
else
3235
y = s == 0;
3336
end

0 commit comments

Comments
 (0)