diff options
Diffstat (limited to 'tex/context/base/mkiv/l-os.lua')
-rw-r--r-- | tex/context/base/mkiv/l-os.lua | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/tex/context/base/mkiv/l-os.lua b/tex/context/base/mkiv/l-os.lua index 06cc35a79..b46036757 100644 --- a/tex/context/base/mkiv/l-os.lua +++ b/tex/context/base/mkiv/l-os.lua @@ -183,11 +183,30 @@ end -- end of environment hack +if not io.fileseparator then + if find(os.getenv("PATH"),";",1,true) then + io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "windows" + else + io.fileseparator, io.pathseparator, os.type = "/" , ":", os.type or "unix" + end +end + +os.type = os.type or (io.pathseparator == ";" and "windows") or "unix" +os.name = os.name or (os.type == "windows" and "mswin" ) or "linux" + +if os.type == "windows" then + os.libsuffix, os.binsuffix, os.binsuffixes = 'dll', 'exe', { 'exe', 'cmd', 'bat' } +else + os.libsuffix, os.binsuffix, os.binsuffixes = 'so', '', { '' } +end + local execute = os.execute local iopopen = io.popen +local ostype = os.type local function resultof(command) - local handle = iopopen(command,"rb") -- already has flush, b is new ! + -- already has flush, b is new and we need it to pipe xz output + local handle = iopopen(command,ostype == "windows" and "rb" or "r") if handle then local result = handle:read("*all") or "" handle:close() @@ -203,22 +222,6 @@ function os.pipeto(command) return iopopen(command,"w") -- already has flush end -if not io.fileseparator then - if find(os.getenv("PATH"),";",1,true) then - io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "windows" - else - io.fileseparator, io.pathseparator, os.type = "/" , ":", os.type or "unix" - end -end - -os.type = os.type or (io.pathseparator == ";" and "windows") or "unix" -os.name = os.name or (os.type == "windows" and "mswin" ) or "linux" - -if os.type == "windows" then - os.libsuffix, os.binsuffix, os.binsuffixes = 'dll', 'exe', { 'exe', 'cmd', 'bat' } -else - os.libsuffix, os.binsuffix, os.binsuffixes = 'so', '', { '' } -end local launchers = { windows = "start %s", |