summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-05-18 23:40:14 +0300
committerMarius <mariausol@gmail.com>2011-05-18 23:40:14 +0300
commitb714ce8e20b324368a7ab233be6fa9a0e50befa4 (patch)
tree6c89c4f614b2c3f38180a77b937a26a330af015c /tex/context/base/l-dir.lua
parentf68b6626917f73ba448040a8667d0b2b9700ca6c (diff)
downloadcontext-b714ce8e20b324368a7ab233be6fa9a0e50befa4.tar.gz
stable 2011.05.18 18:04
Diffstat (limited to 'tex/context/base/l-dir.lua')
-rw-r--r--tex/context/base/l-dir.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index 40b94782b..1d59b9220 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['l-dir'] = {
local type = type
local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub
-local concat = table.concat
+local concat, insert, remove = table.concat, table.insert, table.remove
local lpegmatch = lpeg.match
local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V
@@ -413,3 +413,17 @@ else
end
file.expandname = dir.expandname -- for convenience
+
+local stack = { }
+
+function dir.push(newdir)
+ insert(stack,lfs.currentdir())
+end
+
+function dir.pop()
+ local d = remove(stack)
+ if d then
+ lfs.chdir(d)
+ end
+ return d
+end