diff options
-rw-r--r-- | src/luarocks/build.lua | 2 | ||||
-rw-r--r-- | src/luarocks/install.lua | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index b7386688..6eca0c3e 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -278,7 +278,7 @@ function run(...) | |||
278 | end | 278 | end |
279 | assert(type(version) == "string" or not version) | 279 | assert(type(version) == "string" or not version) |
280 | 280 | ||
281 | if not flags["local"] and not fs.is_writable(cfg.root_dir) then | 281 | if not flags["local"] and (fs.exists(cfg.root_dir) and not fs.is_writable(cfg.root_dir)) then |
282 | return nil, "Your user does not have write permissions in " .. cfg.root_dir .. | 282 | return nil, "Your user does not have write permissions in " .. cfg.root_dir .. |
283 | " \n-- you may want to run as a privileged user or use your local tree with --local." | 283 | " \n-- you may want to run as a privileged user or use your local tree with --local." |
284 | end | 284 | end |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index 4bb073dc..f9f27ccf 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
@@ -107,14 +107,14 @@ function run(...) | |||
107 | return nil, "Argument missing, see help." | 107 | return nil, "Argument missing, see help." |
108 | end | 108 | end |
109 | 109 | ||
110 | if not flags["local"] and not fs.is_writable(cfg.root_dir) then | 110 | if not flags["local"] and (fs.exists(cfg.root_dir) and not fs.is_writable(cfg.root_dir)) then |
111 | return nil, "Your user does not have write permissions in " .. cfg.root_dir .. | 111 | return nil, "Your user does not have write permissions in " .. cfg.root_dir .. |
112 | " \n-- you may want to run as a privileged user or use your local tree with --local." | 112 | " \n-- you may want to run as a privileged user or use your local tree with --local." |
113 | end | 113 | end |
114 | 114 | ||
115 | if name:match("%.rockspec$") or name:match("%.src%.rock$") then | 115 | if name:match("%.rockspec$") or name:match("%.src%.rock$") then |
116 | local build = require("luarocks.build") | 116 | local build = require("luarocks.build") |
117 | return build.run(name) | 117 | return build.run(name, flags["local"] and "--local") |
118 | elseif name:match("%.rock$") then | 118 | elseif name:match("%.rock$") then |
119 | return install_binary_rock(name) | 119 | return install_binary_rock(name) |
120 | else | 120 | else |