[go: nahoru, domu]

Skip to content

Commit

Permalink
always make --global target the system tree
Browse files Browse the repository at this point in the history
This alleviates the issue in the specific invocation given in #1425,
but I don't think it is a full solution.

See #1425.
  • Loading branch information
hishamhm committed Mar 11, 2024
1 parent 1f8530a commit 24a8f07
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/luarocks/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ do
process_tree_args = function(args, project_dir)

if args.global then
cfg.local_by_default = false
end

if args.tree then
local ok, err = set_named_tree(args, "system")
if not ok then
return nil, err
end
elseif args.tree then
local named = set_named_tree(args, args.tree)
if not named then
local root_dir = fs.absolute_name(args.tree)
Expand All @@ -97,15 +98,21 @@ do
"You are running as a superuser, which is intended for system-wide operation.\n"..
"To force using the superuser's home, use --tree explicitly."
else
set_named_tree(args, "user")
local ok, err = set_named_tree(args, "user")
if not ok then
return nil, err
end
end
elseif args.project_tree then
local tree = args.project_tree
table.insert(cfg.rocks_trees, 1, { name = "project", root = tree } )
manif.load_rocks_tree_manifests()
path.use_tree(tree)
elseif cfg.local_by_default then
set_named_tree(args, "user")
local ok, err = set_named_tree(args, "user")
if not ok then
return nil, err
end
elseif project_dir then
local project_tree = project_dir .. "/lua_modules"
table.insert(cfg.rocks_trees, 1, { name = "project", root = project_tree } )
Expand Down

0 comments on commit 24a8f07

Please sign in to comment.