diff options
Diffstat (limited to 'tex/context/base/l-dir.lua')
-rw-r--r-- | tex/context/base/l-dir.lua | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index 40081cc3b..3d0576eeb 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -26,8 +26,6 @@ local isfile = lfs.isfile local currentdir = lfs.currentdir local chdir = lfs.chdir -local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") - -- in case we load outside luatex if not isdir then @@ -138,33 +136,11 @@ end dir.collectpattern = collectpattern -local separator - -if onwindows then -- we could sanitize here - --- pattern = Ct { --- [1] = (C(P(".") + S("/\\")^1) + C(R("az","AZ") * P(":") * S("/\\")^0) + Cc("./")) * V(2) * V(3), --- [2] = C(((1-S("*?/\\"))^0 * S("/\\"))^0), --- [3] = C(P(1)^0) --- } - - local slash = S("/\\") / "/" - - pattern = Ct { - [1] = (Cs(P(".") + slash^1) + Cs(R("az","AZ") * P(":") * slash^0) + Cc("./")) * V(2) * V(3), - [2] = Cs(((1-S("*?/\\"))^0 * slash)^0), - [3] = Cs(P(1)^0) - } - -else -- assume unix - - pattern = Ct { - [1] = (C(P(".") + P("/")^1) + Cc("./")) * V(2) * V(3), - [2] = C(((1-S("*?/"))^0 * P("/"))^0), - [3] = C(P(1)^0) - } - -end +local pattern = Ct { + [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), + [2] = C(((1-S("*?/"))^0 * P("/"))^0), + [3] = C(P(1)^0) +} local filter = Cs ( ( P("**") / ".*" + @@ -281,6 +257,8 @@ end local make_indeed = true -- false +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + if onwindows then function dir.mkdirs(...) @@ -295,8 +273,9 @@ if onwindows then str = str .. "/" .. s end end + local first, middle, last local drive = false - local first, middle, last = match(str,"^(//)(//*)(.*)$") + first, middle, last = match(str,"^(//)(//*)(.*)$") if first then -- empty network path == local path else |