Skip to content

Commit bf25647

Browse files
committed
has_dotnet with Matlab < R2022b
1 parent df5018f commit bf25647

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

+stdlib/dotnet_home.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
%% DOTNET_HOME give .NET RuntimeLocation
22

33
function h = dotnet_home()
4-
5-
h = dotnetenv().RuntimeLocation;
6-
7-
end
4+
try
5+
h = dotnetenv().RuntimeLocation;
6+
catch
7+
h = "";
8+
end
9+
end

+stdlib/has_dotnet.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
try
99
y = NET.isNETSupported;
1010
catch
11-
y = false;
11+
try
12+
y = stdlib.dotnet_api() >= 4;
13+
catch
14+
y = false;
15+
end
1216
end
1317

1418
end

test/TestLang.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ function test_python_home(tc)
2727

2828
function test_dotnet_home(tc)
2929
tc.assumeTrue(stdlib.has_dotnet(), ".NET not available")
30-
tc.verifyNotEmpty(stdlib.dotnet_home())
30+
h = stdlib.dotnet_home();
31+
32+
if stdlib.matlabOlderThan('R2022b')
33+
tc.verifyEmpty(h)
34+
else
35+
tc.verifyNotEmpty(h)
36+
end
3137
end
3238

3339
function test_dotnet_version(tc)

0 commit comments

Comments
 (0)