File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 33
44function y = is_admin()
55
6+
67if 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.
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
1925else
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" )
2227end
2328
2429end
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -257,8 +257,6 @@ function build_exe(context)
257257
258258win = [pure , " src/windows.cpp" ];
259259
260- mac = " src/macos.cpp" ;
261-
262260sym = " 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
279275if (isMATLABReleaseOlderThan(" R2024b" ) && ~stdlib .has_dotnet()) || build_all
You can’t perform that action at this time.
0 commit comments