diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-09-10 14:32:08 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-09-10 14:32:08 -0300 |
commit | 9f65f27ac92c8ce7fa6ea7f03d6f59c54d6f1b22 (patch) | |
tree | 2f54745b0b1b9e4b66e765bfd39df5986bbe3b57 | |
parent | 6d83783e43061b6231f47dfb14eb6b5937555558 (diff) | |
download | luarocks-9f65f27ac92c8ce7fa6ea7f03d6f59c54d6f1b22.tar.gz luarocks-9f65f27ac92c8ce7fa6ea7f03d6f59c54d6f1b22.tar.bz2 luarocks-9f65f27ac92c8ce7fa6ea7f03d6f59c54d6f1b22.zip |
Improve behavior of --local check.
-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 |