Skip to content

Commit 1625339

Browse files
committed
remove unneeeded fcn
1 parent 23cbcc2 commit 1625339

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

+stdlib/cpu_arch.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
%% CPU_ARCH get the CPU architecture
22
% optional: java
33

4-
function arch = cpu_arch()
4+
function a = cpu_arch()
55

66
if NET.isNETSupported()
7-
arch = string(System.Runtime.InteropServices.RuntimeInformation.OSArchitecture);
7+
a = System.Runtime.InteropServices.RuntimeInformation.OSArchitecture;
88
else
9-
arch = javaSystemProperty("os.arch");
9+
a = javaMethod("getProperty", "java.lang.System", "os.arch");
10+
end
11+
12+
try %#ok<*TRYNC>
13+
a = string(a);
1014
end
1115

1216
end

+stdlib/get_username.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
function n = get_username()
55

66
if NET.isNETSupported()
7-
n = string(System.Environment.UserName);
7+
n = System.Environment.UserName;
88
else
9-
n = javaSystemProperty("user.name");
9+
n = javaMethod("getProperty", "java.lang.System", "user.name");
10+
end
11+
12+
try %#ok<*TRYNC>
13+
n = string(n);
1014
end
1115

1216
end

+stdlib/java_vendor.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
function v = java_vendor()
55

6-
v = javaSystemProperty("java.vendor");
6+
v = javaMethod("getProperty", "java.lang.System", "java.vendor");
7+
8+
try %#ok<*TRYNC>
9+
v = string(v);
10+
end
711

812
end
913

+stdlib/java_version.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
function v = java_version()
1212

13-
v = javaSystemProperty("java.version");
13+
v = javaMethod("getProperty", "java.lang.System", "java.version");
1414

15+
try %#ok<*TRYNC>
16+
v = string(v);
1517
end
1618

1719
%!assert(!isempty(java_version()))

+stdlib/os_version.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77

88
function [os, version] = os_version()
99

10-
os = javaSystemProperty("os.name");
11-
version = javaSystemProperty("os.version");
10+
os = javaMethod("getProperty", "java.lang.System", "os.name");
11+
version = javaMethod("getProperty", "java.lang.System", "os.version");
1212

13+
try %#ok<*TRYNC>
14+
os = string(os);
15+
version = string(version);
1316
end
1417

1518
%!test

+stdlib/private/javaSystemProperty.m

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)