Skip to content

Commit 700d05b

Browse files
committed
don't build unneeded mex files
1 parent ccd2a4b commit 700d05b

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

+stdlib/is_admin.m

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
function y = is_admin()
55

6+
67
if stdlib.isoctave()
78
y = getuid() == 0;
8-
elseif ispc()
9+
elseif ispc() && stdlib.has_dotnet()
910
% com.sun.security.auth.module.NTSystem().getGroupIDs();
1011
% Administrator group SID (S-1-5-32-544) is not an appropriate check .getGroupIDs because it
1112
% only tells if a user is *allowed* to run as admin, not if they are currently running as admin.
@@ -14,11 +15,15 @@
1415
identity = System.Security.Principal.WindowsIdentity.GetCurrent();
1516
principal = System.Security.Principal.WindowsPrincipal(identity);
1617
y = principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator);
17-
elseif stdlib.has_java()
18-
y = com.sun.security.auth.module.UnixSystem().getUid() == 0;
18+
elseif isunix()
19+
if stdlib.has_java()
20+
y = com.sun.security.auth.module.UnixSystem().getUid() == 0;
21+
else
22+
[s, r] = system('id -u');
23+
y = s == 0 && strip(r) == "0";
24+
end
1925
else
20-
[s, r] = system('id -u');
21-
y = s == 0 && strip(r) == "0";
26+
error("stdlib:is_admin:UnsupportedPlatform", "is_admin() is not supported on this platform")
2227
end
2328

2429
end

+stdlib/is_rosetta.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
%% IS_ROSETTA on Apple Silicon via Rosetta
2-
% optional: mex
32
%
43
% true if Matlab on Apple Silicon CPU is built for Intel x86_64
54

+stdlib/is_wsl.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
%% IS_WSL detect if running under WSL
2-
% optional: mex
32
%
43
% Detects if Matlab or GNU Octave is installed and running from within
54
% Windows Subsystem for Linux

buildfile.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ function build_exe(context)
257257

258258
win = [pure, "src/windows.cpp"];
259259

260-
mac = "src/macos.cpp";
261-
262260
sym = "src/symlink_fs.cpp";
263261

264262

@@ -272,8 +270,6 @@ function build_exe(context)
272270
"src/disk_available.cpp", ...
273271
"src/disk_capacity.cpp", ...
274272
"src/set_permissions.cpp", ...
275-
["src/is_rosetta.cpp", mac], ...
276-
["src/drop_slash.cpp", normal], ...
277273
};
278274

279275
if (isMATLABReleaseOlderThan("R2024b") && ~stdlib.has_dotnet()) || build_all

0 commit comments

Comments
 (0)