summaryrefslogtreecommitdiff
path: root/src/luarocks/command_line.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/command_line.lua')
-rw-r--r--src/luarocks/command_line.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua
index 96891b75..528ca068 100644
--- a/src/luarocks/command_line.lua
+++ b/src/luarocks/command_line.lua
@@ -178,9 +178,21 @@ function command_line.run_command(...)
178 end 178 end
179 end 179 end
180 180
181 if not fs.current_dir() or fs.current_dir() == "" then 181 if (not fs.current_dir()) or fs.current_dir() == "" then
182 die("Current directory does not exist. Please run LuaRocks from an existing directory.") 182 die("Current directory does not exist. Please run LuaRocks from an existing directory.")
183 end 183 end
184
185 if fs.attributes(cfg.local_cache, "owner") ~= fs.current_user() or
186 fs.attributes(dir.dir_name(cfg.local_cache), "owner") ~= fs.current_user() then
187 util.warning("The directory '" .. cfg.local_cache .. "' or its parent directory "..
188 "is not owned by the current user and the cache has been disabled. "..
189 "Please check the permissions and owner of that directory. "..
190 (cfg.is_platform("unix")
191 and ("If executing "..util.this_program("luarocks").." with sudo, you may want sudo's -H flag.")
192 or ""))
193 cfg.local_cache = fs.make_temp_dir("local_cache")
194 util.schedule_function(fs.delete, cfg.local_cache)
195 end
184 196
185 if commands[command] then 197 if commands[command] then
186 local cmd = require(commands[command]) 198 local cmd = require(commands[command])