File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 44function y = is_admin()
55
66
7- if stdlib .isoctave()
7+ if stdlib .has_python()
8+ if isunix()
9+ y = py .os .getuid() == 0 ;
10+ else
11+ shell32 = py .ctypes .WinDLL(' shell32' );
12+
13+ % this is a key step vs. simply py.ctypes.windll.shell32.IsUserAnAdmin()
14+ f = py .getattr(shell32 , ' IsUserAnAdmin' );
15+
16+ y = logical(f());
17+ end
18+ elseif stdlib .isoctave()
819 y = getuid() == 0 ;
920elseif ispc() && stdlib .has_dotnet()
1021 % com.sun.security.auth.module.NTSystem().getGroupIDs();
Original file line number Diff line number Diff line change @@ -262,14 +262,17 @@ function build_exe(context)
262262
263263srcs = {
264264" src/remove.cpp" , ...
265- [" src/is_admin.cpp" , " src/admin_fs.cpp" ] ...
266- " src/is_char_device.cpp" , ...
267265[" src/normalize.cpp" , normal ], ...
268266" src/disk_available.cpp" , ...
269267" src/disk_capacity.cpp" , ...
270268" src/set_permissions.cpp" , ...
271269};
272270
271+ if ~stdlib .has_python() || build_all
272+ srcs{end + 1 } = " src/is_char_device.cpp" ;
273+ srcs{end + 1 } = [" src/is_admin.cpp" , " src/admin_fs.cpp" ];
274+ end
275+
273276if (isMATLABReleaseOlderThan(" R2024b" ) && ~stdlib .has_dotnet()) || build_all
274277srcs{end + 1 } = [" src/is_symlink.cpp" , win , sym ];
275278end
You can’t perform that action at this time.
0 commit comments