Skip to content

Commit

Permalink
improve os checks in luvi libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
truemedian committed Jul 3, 2024
1 parent e059e2c commit fc5eb49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/lua/luvibundle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ local pathJoin = luviPath.pathJoin
local getenv = require('os').getenv

local loadstring = loadstring or load
local unpack = unpack or _G.table.unpack
local unpack = unpack or table.unpack

local tmpBase = luviPath.isWindows and (getenv("TMP") or uv.cwd()) or
(getenv("TMPDIR") or '/tmp')
local tmpBase = getenv("TMPDIR") or getenv("TMP") or getenv("TEMP") or (uv.fs_access("/tmp", "r") and "/tmp") or uv.cwd()

-- Bundle from folder on disk
local function folderBundle(base)
Expand Down
6 changes: 3 additions & 3 deletions src/lua/luvipath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ local luvi = require('luvi')
local getPrefix, splitPath, joinParts

local isWindows
if _G.jit then
isWindows = _G.jit.os == "Windows"
if pcall(require, 'jit') then
isWindows = require('jit').os == "Windows"
else
isWindows = not not package.path:match("\\")
isWindows = not not (package.config:sub(1, 1) == "\\" or package.path:find("\\", 1, true) or package.cpath:find("\\", 1, true))
end

if isWindows then
Expand Down

0 comments on commit fc5eb49

Please sign in to comment.