Skip to content

Commit 7909473

Browse files
committed
.NET disk_* more robust
1 parent f2b147c commit 7909473

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

@@ -156,10 +166,14 @@ function test_owner(tc, Po, B_jdps)
156166
tc.assertEqual(char(b), B_jdps)
157167
tc.verifyClass(o, 'char')
158168

159-
if ~stdlib.exists(Po)
160-
tc.verifyEqual(o, '')
169+
if ismember(B_jdps, stdlib.Backend().select('get_owner'))
170+
if ~stdlib.exists(Po)
171+
tc.verifyEqual(o, '')
172+
else
173+
tc.verifyGreaterThan(strlength(o), 0)
174+
end
161175
else
162-
tc.verifyGreaterThan(strlength(o), 0)
176+
tc.verifyEmpty(o)
163177
end
164178

165179
end

0 commit comments

Comments
 (0)