Skip to content

Commit 85e69f7

Browse files
committed
dotnet_version standalone
1 parent 3151fe7 commit 85e69f7

File tree

8 files changed

+17
-11
lines changed

8 files changed

+17
-11
lines changed

+stdlib/cpu_arch.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
function a = cpu_arch()
44

5+
a = '';
6+
57
if stdlib.has_dotnet()
68
a = System.Runtime.InteropServices.RuntimeInformation.OSArchitecture;
79
% https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/7.0/osarchitecture-emulation
8-
else
10+
elseif stdlib.has_java()
911
a = javaMethod("getProperty", "java.lang.System", "os.arch");
1012
end
1113

+stdlib/create_symlink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if stdlib.has_python()
2929
py.pathlib.Path(link).symlink_to(target);
3030
ok = true;
31-
elseif stdlib.has_dotnet() && stdlib.dotnet_api() >= 6
31+
elseif stdlib.dotnet_api() >= 6
3232
% https://learn.microsoft.com/en-us/dotnet/api/system.io.file.createsymboliclink
3333
System.IO.File.CreateSymbolicLink(link, target);
3434
ok = true;

+stdlib/dotnet_api.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
%% DOTNET_API major version integer .NET
1+
%% DOTNET_API major version integer .NET
22

33
function v = dotnet_api()
44

5-
v = System.Environment.Version.Major;
5+
try
6+
v = System.Environment.Version.Major;
7+
catch
8+
v = -1;
9+
end
610

711
end

+stdlib/get_owner.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%% GET_OWNER owner of file or directory
1+
%% GET_OWNER owner name of file or directory
22
%
33
%%% Inputs
44
% * p: path to examine

+stdlib/read_symlink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
if stdlib.has_python()
2323
% https://docs.python.org/3/library/pathlib.html#pathlib.Path.readlink
2424
r = string(py.str(py.pathlib.Path(p).readlink()));
25-
elseif stdlib.has_dotnet() && stdlib.dotnet_api() >= 6
25+
elseif stdlib.dotnet_api() >= 6
2626
r = System.IO.FileInfo(p).LinkTarget;
2727
elseif stdlib.has_java()
2828
% must be absolute path

+stdlib/relative_to.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
end
1818

1919

20-
if stdlib.has_dotnet() && stdlib.dotnet_api() >= 5
20+
if stdlib.dotnet_api() >= 5
2121

2222
if strempty(base) && strempty(other), rel = "."; return, end
2323

buildfile.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ function build_exe(context)
277277
srcs{end+1} = ["src/is_symlink.cpp", win, sym];
278278
end
279279

280-
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_java() && ~stdlib.has_python() && ~stdlib.has_dotnet() || stdlib.dotnet_api() < 6) || build_all
280+
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_java() && ~stdlib.has_python() && stdlib.dotnet_api() < 6) || build_all
281281
srcs{end+1} = ["src/read_symlink.cpp", win, sym];
282282
end
283283

284-
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_python() && ~stdlib.has_dotnet() || stdlib.dotnet_api() < 6) || build_all
284+
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_python() && stdlib.dotnet_api() < 6) || build_all
285285
% so that we don't need to run matlab AsAdmin on Windows
286286
srcs{end+1} = ["src/create_symlink.cpp", win, sym];
287287
end

test/TestRelative.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
methods (Test)
99

1010
function test_relative_to(tc, pr)
11-
tc.assumeTrue((stdlib.has_dotnet() && stdlib.dotnet_api() >= 5) || stdlib.is_mex_fun("stdlib.relative_to"))
11+
tc.assumeTrue((stdlib.dotnet_api() >= 5) || stdlib.is_mex_fun("stdlib.relative_to"))
1212

1313
tc.verifyEqual(stdlib.relative_to(pr{1}, pr{2}), pr{3}, ...
1414
"relative_to(" + pr{1} + "," + pr{2}+")")
1515
end
1616

1717
function test_proximate_to(tc, pp)
18-
tc.assumeTrue((stdlib.has_dotnet() && stdlib.dotnet_api() >= 5) || stdlib.is_mex_fun("stdlib.proximate_to"))
18+
tc.assumeTrue((stdlib.dotnet_api() >= 5) || stdlib.is_mex_fun("stdlib.proximate_to"))
1919

2020
tc.verifyEqual(stdlib.proximate_to(pp{1}, pp{2}), pp{3}, ...
2121
"proximate_to(" + pp{1} + ", " + pp{2}+")")

0 commit comments

Comments
 (0)