Skip to content

Commit 29c6509

Browse files
committed
is_dev_drive: use missing
is_removable: use missing samepath: use missing device: use missing disk_capacity use missing ram_* using missing
1 parent ff5c362 commit 29c6509

41 files changed

Lines changed: 102 additions & 121 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

+stdlib/+dotnet/disk_available.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function i = disk_available(file)
44

5-
i = uint64([]);
5+
i = missing;
66
% Windows needs exists() not just strempty()
77
if ~stdlib.exists(file)
88
return
@@ -12,10 +12,9 @@
1212
% absolutizing is necessary for Windows especially
1313
i = System.IO.DriveInfo(System.IO.Path.GetFullPath(file)).AvailableFreeSpace();
1414
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.availablefreespace
15+
i = uint64(i);
1516
catch e
1617
dotnetException(e)
1718
end
1819

19-
i = uint64(i);
20-
2120
end

+stdlib/+dotnet/disk_capacity.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function i = disk_capacity(file)
44

5-
i = uint64([]);
5+
i = missing;
66
% Windows needs exists() not just strempty()
77
if ~stdlib.exists(file)
88
return
@@ -12,10 +12,10 @@
1212
% absolutizing is necessary for Windows especially
1313
i = System.IO.DriveInfo(System.IO.Path.GetFullPath(file)).TotalSize();
1414
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.totalsize
15+
i = uint64(i);
1516
catch e
1617
dotnetException(e)
1718
end
1819

19-
i = uint64(i);
2020

2121
end

+stdlib/+dotnet/ram_total.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
% https://learn.microsoft.com/en-us/dotnet/api/system.gcmemoryinfo.totalavailablememorybytes
66
try
77
bytes = System.GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;
8+
bytes = uint64(bytes);
89
catch
9-
bytes = [];
10+
bytes = missing;
1011
end
1112

12-
bytes = uint64(bytes);
1313
end

+stdlib/+java/device.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function i = device(file)
22

3-
i = uint64([]);
3+
i = missing;
44

55
if stdlib.strempty(file)
66
return
@@ -14,9 +14,9 @@
1414
p = javaAbsolutePath(file);
1515
i = javaMethod('getAttribute', 'java.nio.file.Files', p, 'unix:dev', opt);
1616
% i = java.nio.file.Files.getAttribute(javaAbsolutePath(file), "unix:dev", opt);
17+
i = uint64(i);
1718
catch e
1819
javaException(e)
1920
end
2021

21-
i = uint64(i);
2222
end

+stdlib/+java/disk_available.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
o = javaObject('java.io.File', file);
55
i = javaMethod('getUsableSpace', o);
66
if i < 1
7-
i = [];
7+
i = missing;
8+
else
9+
i = uint64(i);
810
end
911
catch e
1012
javaException(e)
11-
i = [];
13+
i = missing;
1214
end
1315

14-
i = uint64(i);
1516

1617
end

+stdlib/+java/disk_capacity.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
function i = disk_capacity(file)
22

3+
i = missing;
4+
35
try
46
o = javaObject('java.io.File', file);
57
i = javaMethod('getTotalSpace', o);
68
if i < 1
7-
i = [];
9+
i = missing;
10+
else
11+
i = uint64(i);
812
end
913
catch e
1014
javaException(e)
11-
i = [];
1215
end
1316

14-
i = uint64(i);
15-
1617
end

+stdlib/+java/inode.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function i = inode(file)
22

3-
i = uint64([]);
3+
i = missing;
44

55
if stdlib.strempty(file)
66
return
@@ -14,9 +14,9 @@
1414
p = javaAbsolutePath(file);
1515
i = javaMethod('getAttribute', 'java.nio.file.Files', p, 'unix:ino', opt);
1616
% i = java.nio.file.Files.getAttribute(javaAbsolutePath(file), "unix:ino", opt);
17+
i = uint64(i);
1718
catch e
1819
javaException(e)
1920
end
2021

21-
i = uint64(i);
2222
end

+stdlib/+java/ram_free.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
else
99
bytes = b.getFreeMemorySize();
1010
end
11+
bytes = uint64(bytes);
1112
catch e
1213
javaException(e)
13-
bytes = [];
14+
bytes = missing;
1415
end
1516

16-
bytes = uint64(bytes);
17-
1817
end

+stdlib/+java/ram_total.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
else
1313
bytes = b.getTotalMemorySize();
1414
end
15+
bytes = uint64(bytes);
1516
catch e
1617
javaException(e)
17-
bytes = [];
18+
bytes = missing;
1819
end
1920

20-
bytes = uint64(bytes);
2121

2222
end

+stdlib/+java/samepath.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
end
1414
catch e
1515
javaException(e)
16-
y = logical([]);
16+
y = missing;
1717
end
1818

1919
end

0 commit comments

Comments
 (0)