summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2011-05-18 18:04:00 +0200
committerHans Hagen <pragma@wxs.nl>2011-05-18 18:04:00 +0200
commit1a4587e7d792561d779de21e88eb424539085090 (patch)
tree9c53cc6de8d0fc4497f4efb7b57071127e1785ea /tex/context/base/l-dir.lua
parent5eca07d318d43832522e3482a000ab933c25a420 (diff)
downloadcontext-1a4587e7d792561d779de21e88eb424539085090.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