Skip to content

Commit 65bfbf8

Browse files
committed
update lfs detection
1 parent 1b9630e commit 65bfbf8

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

z.lua

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,20 +2691,24 @@ end
26912691
-- LFS optimize
26922692
-----------------------------------------------------------------------
26932693
os.lfs = {}
2694-
os.lfs.disable = os.getenv('_ZL_DISABLE_LFS')
2695-
if os.lfs.disable == nil then
2696-
os.lfs.status, os.lfs.pkg = pcall(require, 'lfs')
2697-
if os.lfs.status then
2698-
local lfs = os.lfs.pkg
2699-
os.path.exists = function (name)
2700-
return lfs.attributes(name) and true or false
2701-
end
2702-
os.path.isdir = function (name)
2703-
local mode = lfs.attributes(name)
2704-
if not mode then
2705-
return false
2694+
os.lfs.enable = os.getenv('_ZL_USE_LFS')
2695+
os.lfs.enable = '1'
2696+
if os.lfs.enable ~= nil then
2697+
local m = string.lower(os.lfs.enable)
2698+
if (m == '1' or m == 'yes' or m == 'true' or m == 't') then
2699+
os.lfs.status, os.lfs.pkg = pcall(require, 'lfs')
2700+
if os.lfs.status then
2701+
local lfs = os.lfs.pkg
2702+
os.path.exists = function (name)
2703+
return lfs.attributes(name) and true or false
2704+
end
2705+
os.path.isdir = function (name)
2706+
local mode = lfs.attributes(name)
2707+
if not mode then
2708+
return false
2709+
end
2710+
return (mode.mode == 'directory') and true or false
27062711
end
2707-
return (mode.mode == 'directory') and true or false
27082712
end
27092713
end
27102714
end

0 commit comments

Comments
 (0)