diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/fs/unix/tools.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index fdec7869..5d3afd5e 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
@@ -6,7 +6,7 @@ local fs = require("luarocks.fs") | |||
6 | 6 | ||
7 | local cfg = require("luarocks.cfg") | 7 | local cfg = require("luarocks.cfg") |
8 | 8 | ||
9 | dir_stack = {} | 9 | local dir_stack = {} |
10 | 10 | ||
11 | --- Run the given command. | 11 | --- Run the given command. |
12 | -- The command is executed in the current directory in the dir stack. | 12 | -- The command is executed in the current directory in the dir stack. |
@@ -31,7 +31,7 @@ function current_dir() | |||
31 | current = pipe:read("*l") | 31 | current = pipe:read("*l") |
32 | pipe:close() | 32 | pipe:close() |
33 | end | 33 | end |
34 | for _, d in ipairs(fs.dir_stack) do | 34 | for _, d in ipairs(dir_stack) do |
35 | current = fs.absolute_name(d, current) | 35 | current = fs.absolute_name(d, current) |
36 | end | 36 | end |
37 | return current | 37 | return current |
@@ -44,19 +44,19 @@ end | |||
44 | -- @param d string: The directory to switch to. | 44 | -- @param d string: The directory to switch to. |
45 | function change_dir(d) | 45 | function change_dir(d) |
46 | assert(type(d) == "string") | 46 | assert(type(d) == "string") |
47 | table.insert(fs.dir_stack, d) | 47 | table.insert(dir_stack, d) |
48 | end | 48 | end |
49 | 49 | ||
50 | --- Change directory to root. | 50 | --- Change directory to root. |
51 | -- Allows leaving a directory (e.g. for deleting it) in | 51 | -- Allows leaving a directory (e.g. for deleting it) in |
52 | -- a crossplatform way. | 52 | -- a crossplatform way. |
53 | function change_dir_to_root() | 53 | function change_dir_to_root() |
54 | table.insert(fs.dir_stack, "/") | 54 | table.insert(dir_stack, "/") |
55 | end | 55 | end |
56 | 56 | ||
57 | --- Change working directory to the previous in the dir stack. | 57 | --- Change working directory to the previous in the dir stack. |
58 | function pop_dir() | 58 | function pop_dir() |
59 | local d = table.remove(fs.dir_stack) | 59 | local d = table.remove(dir_stack) |
60 | return d ~= nil | 60 | return d ~= nil |
61 | end | 61 | end |
62 | 62 | ||