summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-04-01 14:16:00 +0200
committerHans Hagen <pragma@wxs.nl>2013-04-01 14:16:00 +0200
commit5ffca95797ff488ed1be9a5361bc4106c73a0a27 (patch)
tree855f2ed7c01dbd848c9963c4c339e8384dd9763f /tex/context/base/l-dir.lua
parent6c0c7b0339872c6bedb7a69b5a1b1c162015ce5d (diff)
downloadcontext-5ffca95797ff488ed1be9a5361bc4106c73a0a27.tar.gz
beta 2013.04.01 14:16
Diffstat (limited to 'tex/context/base/l-dir.lua')
-rw-r--r--tex/context/base/l-dir.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index 0568bcfb5..00cda3899 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -24,6 +24,7 @@ local walkdir = lfs.dir
local isdir = lfs.isdir
local isfile = lfs.isfile
local currentdir = lfs.currentdir
+local chdir = lfs.chdir
-- in case we load outside luatex
@@ -385,7 +386,7 @@ if onwindows then
function dir.expandname(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = dir.current() .. "/"
+ first = dir.current() .. "/" -- dir.current sanitizes
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -394,10 +395,10 @@ if onwindows then
first, last = match(str,"^([a-zA-Z]:)(.*)$")
if first and not find(last,"^/") then
local d = currentdir()
- if lfs.chdir(first) then
+ if chdir(first) then
first = dir.current()
end
- lfs.chdir(d)
+ chdir(d)
end
end
if not first then
@@ -433,13 +434,16 @@ file.expandname = dir.expandname -- for convenience
local stack = { }
function dir.push(newdir)
- insert(stack,lfs.currentdir())
+ insert(stack,currentdir())
+ if newdir and newdir ~= "" then
+ chdir(newdir)
+ end
end
function dir.pop()
local d = remove(stack)
if d then
- lfs.chdir(d)
+ chdir(d)
end
return d
end