summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-04-01 15:40:24 +0300
committerMarius <mariausol@gmail.com>2013-04-01 15:40:24 +0300
commit7dc68c3dfa63b8669aaa2af75418bec04d52565f (patch)
treeee27fbf673f035551140a175ae43d4dbe891f98c /tex/context/base/l-dir.lua
parent883c139f66ddd567c2323b333fa6694c33c2e5c5 (diff)
downloadcontext-7dc68c3dfa63b8669aaa2af75418bec04d52565f.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