Skip to content

Commit fc0282f

Browse files
committed
consistent output type
1 parent 553a325 commit fc0282f

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

+stdlib/+python/is_mount.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44

55
function y = is_mount(filepath)
66

7-
y = logical.empty;
87

9-
10-
try %#ok<TRYNC>
8+
try
9+
y = false;
1110

1211
p = py.pathlib.Path(filepath);
13-
if ~p.exists(), return, end
12+
if ~p.exists()
13+
return
14+
end
1415

1516
% some Python on CI needs this. Didn't replicate on local Windows PC.
1617
if ispc() && strcmp(filepath, string(p.drive)) && ~endsWith(filepath, ["/", filesep])
17-
y = false;
1818
return
1919
end
2020

2121
y = py.os.path.ismount(p);
22+
catch e
23+
pythonException(e)
24+
y = logical.empty;
2225
end
2326

2427
end

+stdlib/+sys/get_owner.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
cmd = sprintf('stat -c %%U "%s"', file);
1414
end
1515

16+
% Windows needs exists() rather than just ~strempty()
1617
if stdlib.exists(file)
1718
[s, m] = system(cmd);
1819
if s == 0

+stdlib/+sys/is_mount.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
end
55

66
cmd = '';
7-
y = logical.empty;
8-
if ~stdlib.exists(filepath), return, end
7+
if ~stdlib.exists(filepath)
8+
y = false;
9+
return
10+
end
911

1012
if ispc()
1113
if ismember(filepath, ["/", "\"]) || ...

+stdlib/get_owner.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
backend (1,:) string = ["java", "dotnet", "python", "sys"]
1414
end
1515

16-
r = string.empty;
16+
r = '';
1717

1818
for b = backend
1919
switch b

test/TestDisk.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function test_is_mount(tc, B_ps)
7171

7272
tc.verifyClass(y, 'logical')
7373
tc.verifyTrue(stdlib.is_mount("/", B_ps))
74-
tc.verifyEmpty(stdlib.is_mount(tempname(), B_ps))
74+
tc.verifyFalse(stdlib.is_mount(tempname(), B_ps))
7575

7676
if ispc()
7777
sd = getenv("SystemDrive");

0 commit comments

Comments
 (0)