Skip to content

Commit c97a4a4

Browse files
committed
examples per file, faster switching, Octave compatibility
1 parent abef96f commit c97a4a4

File tree

127 files changed

+475
-189
lines changed

Some content is hidden

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

127 files changed

+475
-189
lines changed

+stdlib/+dotnet/create_symlink.m

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

1919
end

+stdlib/+dotnet/disk_available.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function i = disk_available(file)
44

5-
i = uint64.empty;
5+
i = uint64([]);
66
% Windows needs exists() not just strempty()
77
if ~stdlib.exists(file)
88
return

+stdlib/+dotnet/disk_capacity.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function i = disk_capacity(file)
44

5-
i = uint64.empty;
5+
i = uint64([]);
66
% Windows needs exists() not just strempty()
77
if ~stdlib.exists(file)
88
return

+stdlib/+dotnet/is_admin.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
function y = is_admin()
44

55

6-
y = logical.empty;
6+
y = logical([]);
77
if ~ispc()
88
return
99
end

+stdlib/+dotnet/is_symlink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
end
1919
catch e
2020
dotnetException(e)
21-
y = logical.empty;
21+
y = logical([]);
2222
end
2323

2424
end

+stdlib/+java/cpu_load.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function L = cpu_load()
22

33
try
4-
b = java.lang.management.ManagementFactory.getOperatingSystemMXBean();
4+
b = javaMethod('getOperatingSystemMXBean', 'java.lang.management.ManagementFactory');
55

66
L = b.getSystemLoadAverage();
77
if L < 0

+stdlib/+java/device.m

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

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

55
if stdlib.strempty(file)
66
return
@@ -10,8 +10,10 @@
1010
% seen on older Matlab versions on HPC
1111

1212
try
13-
opt = java.nio.file.LinkOption.values();
14-
i = java.nio.file.Files.getAttribute(javaAbsolutePath(file), "unix:dev", opt);
13+
opt = javaMethod('values', 'java.nio.file.LinkOption');
14+
p = javaAbsolutePath(file);
15+
i = javaMethod('getAttribute', 'java.nio.file.Files', p, 'unix:dev', opt);
16+
% i = java.nio.file.Files.getAttribute(javaAbsolutePath(file), "unix:dev", opt);
1517
catch e
1618
javaException(e)
1719
end

+stdlib/+java/disk_available.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
function i = disk_available(file)
22

33
try
4-
i = java.io.File(file).getUsableSpace();
4+
o = javaObject('java.io.File', file);
5+
i = javaMethod('getUsableSpace', o);
56
if i < 1
67
i = [];
78
end

+stdlib/+java/disk_capacity.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
function i = disk_capacity(file)
22

33
try
4-
i = java.io.File(file).getTotalSpace();
4+
o = javaObject('java.io.File', file);
5+
i = javaMethod('getTotalSpace', o);
56
if i < 1
67
i = [];
78
end

+stdlib/+java/filesystem_type.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
try
1717
% Java 1.8 benefits from absolute path, especially on Windows
18-
t = char(java.nio.file.Files.getFileStore(javaAbsolutePath(file)).type);
18+
p = javaAbsolutePath(file);
19+
s = javaMethod('getFileStore', 'java.nio.file.Files', p);
20+
t = char(s.type);
1921
catch e
2022
javaException(e)
2123
end

0 commit comments

Comments
 (0)