Skip to content

Commit 154a670

Browse files
committed
.NET disk_* more robust
1 parent 1f5a53e commit 154a670

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

+stdlib/+dotnet/get_owner.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
try
1111
ntAccountType = System.Type.GetType('System.Security.Principal.NTAccount');
12-
if isempty(ntAccountType)
13-
return
14-
end
1512

1613
if isfolder(file)
1714
fsec = System.IO.Directory.GetAccessControl(file);

test/TestDisk.m

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ function test_disk_available(tc, Ps, B_jdps)
2828

2929
tc.verifyClass(r, 'uint64')
3030

31-
if stdlib.exists(Ps)
32-
tc.verifyGreaterThanOrEqual(r, 0)
31+
if ismember(B_jdps, stdlib.Backend().select('disk_available'))
32+
if stdlib.exists(Ps)
33+
tc.verifyGreaterThanOrEqual(r, 0)
34+
else
35+
tc.verifyEmpty(r)
36+
end
3337
else
3438
tc.verifyEmpty(r)
3539
end
40+
3641
end
3742

3843

@@ -42,11 +47,16 @@ function test_disk_capacity(tc, Ps, B_jdps)
4247

4348
tc.verifyClass(r, 'uint64')
4449

45-
if stdlib.exists(Ps)
46-
tc.verifyGreaterThanOrEqual(r, 0)
50+
if ismember(B_jdps, stdlib.Backend().select('disk_capacity'))
51+
if stdlib.exists(Ps)
52+
tc.verifyGreaterThanOrEqual(r, 0)
53+
else
54+
tc.verifyEmpty(r)
55+
end
4756
else
4857
tc.verifyEmpty(r)
4958
end
59+
5060
end
5161

5262

@@ -169,10 +179,14 @@ function test_owner(tc, Po, B_jdps)
169179
tc.assertEqual(char(b), B_jdps)
170180
tc.verifyClass(o, 'char')
171181

172-
if ~stdlib.exists(Po)
173-
tc.verifyEqual(o, '')
182+
if ismember(B_jdps, stdlib.Backend().select('get_owner'))
183+
if ~stdlib.exists(Po)
184+
tc.verifyEqual(o, '')
185+
else
186+
tc.verifyGreaterThan(strlength(o), 0)
187+
end
174188
else
175-
tc.verifyGreaterThan(strlength(o), 0)
189+
tc.verifyEmpty(o)
176190
end
177191

178192
end

0 commit comments

Comments
 (0)