diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-24 00:16:33 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-24 00:16:33 -0300 |
commit | a027595f718c6b05a8fbd4feae1605bff3fed5b9 (patch) | |
tree | 4b54335cba920e812be7eafa1cc1fea051911feb /src | |
parent | 876d9c892274aa2a0caa47c5db465517388249a7 (diff) | |
download | luarocks-a027595f718c6b05a8fbd4feae1605bff3fed5b9.tar.gz luarocks-a027595f718c6b05a8fbd4feae1605bff3fed5b9.tar.bz2 luarocks-a027595f718c6b05a8fbd4feae1605bff3fed5b9.zip |
Let's try harder to fail if CWD does not exist.
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/command_line.lua | 4 | ||||
-rw-r--r-- | src/luarocks/fs/lua.lua | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 9cc34c42..4ff22c6e 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -192,8 +192,8 @@ function command_line.run_command(...) | |||
192 | cfg.variables[k] = v | 192 | cfg.variables[k] = v |
193 | end | 193 | end |
194 | end | 194 | end |
195 | 195 | ||
196 | if not fs.exists(".") then | 196 | if not fs.current_dir() then |
197 | die("Current directory does not exist. Please run LuaRocks from an existing directory.") | 197 | die("Current directory does not exist. Please run LuaRocks from an existing directory.") |
198 | end | 198 | end |
199 | 199 | ||
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index b3d3f6f1..c3f92bda 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -207,8 +207,13 @@ end | |||
207 | -- Allows leaving a directory (e.g. for deleting it) in | 207 | -- Allows leaving a directory (e.g. for deleting it) in |
208 | -- a crossplatform way. | 208 | -- a crossplatform way. |
209 | function fs_lua.change_dir_to_root() | 209 | function fs_lua.change_dir_to_root() |
210 | table.insert(dir_stack, lfs.currentdir()) | 210 | local current = lfs.currentdir() |
211 | if not current then | ||
212 | return false | ||
213 | end | ||
214 | table.insert(dir_stack, current) | ||
211 | lfs.chdir("/") -- works on Windows too | 215 | lfs.chdir("/") -- works on Windows too |
216 | return true | ||
212 | end | 217 | end |
213 | 218 | ||
214 | --- Change working directory to the previous in the dir stack. | 219 | --- Change working directory to the previous in the dir stack. |