From 01a83b9b8377f66c5258892bc85fff5c218fdbb7 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 17 Apr 2020 18:46:08 -0300 Subject: config: be smarter when configuring the location of Lua If no system-wide permissions, try storing the config locally by default. Also, if setting both lua_dir and --lua-version explicitly, switch the default Lua version. --- src/luarocks/cmd/config.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/luarocks/cmd/config.lua b/src/luarocks/cmd/config.lua index 6d3543b5..bdabe960 100644 --- a/src/luarocks/cmd/config.lua +++ b/src/luarocks/cmd/config.lua @@ -233,7 +233,8 @@ local function get_scope(args) or (args["local"] and "user") or (args.project_tree and "project") or (cfg.local_by_default and "user") - or "system" + or (fs.is_writable(cfg.config_files["system"].file and "system")) + or "user" end --- Driver function for "config" command. -- cgit v1.2.3-55-g6feb