Mercurial > octave
diff scripts/pkg/pkg.m @ 28133:baf16e6f498b
pkg.m: Install packages globally if process has elevated rights (bug #44548).
* pkg.m: On Windows, default to install packages globally if process is running
with elevated rights. Otherwise, install packages locally.
* sysdep.cc (F__is_elevated_process__): New function that checks if Octave is
running as a Windows process with elevated rights.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 22 Feb 2020 17:26:34 +0100 |
parents | fbed279b7074 |
children | 3cffb5c059b4 |
line wrap: on
line diff
--- a/scripts/pkg/pkg.m Sat Feb 22 17:03:01 2020 +0100 +++ b/scripts/pkg/pkg.m Sat Feb 22 17:26:34 2020 +0100 @@ -329,7 +329,7 @@ function [local_packages, global_packages] = pkg (varargin) - ## Installation prefix (FIXME: what should these be on windows?) + ## Installation prefix persistent user_prefix = false; persistent prefix = false; persistent archprefix = -1; @@ -337,9 +337,13 @@ persistent global_list = fullfile (OCTAVE_HOME (), "share", "octave", "octave_packages"); - ## If user is superuser set global_istall to true - ## FIXME: is it OK to set this always true on windows? - global_install = ((ispc () && ! isunix ()) || (geteuid () == 0)); + ## If user is superuser (posix) or the process has elevated rights (Windows), + ## set global_install to true. + if (ispc () && ! isunix ()) + global_install = __is_elevated_process__ (); + else + global_install = (geteuid () == 0); + endif if (isbool (prefix)) [prefix, archprefix] = default_prefix (global_install);