diff --git a/z.lua b/z.lua index 4a78e39..fb0f289 100755 --- a/z.lua +++ b/z.lua @@ -2691,20 +2691,24 @@ end -- LFS optimize ----------------------------------------------------------------------- os.lfs = {} -os.lfs.disable = os.getenv('_ZL_DISABLE_LFS') -if os.lfs.disable == nil then - os.lfs.status, os.lfs.pkg = pcall(require, 'lfs') - if os.lfs.status then - local lfs = os.lfs.pkg - os.path.exists = function (name) - return lfs.attributes(name) and true or false - end - os.path.isdir = function (name) - local mode = lfs.attributes(name) - if not mode then - return false +os.lfs.enable = os.getenv('_ZL_USE_LFS') +os.lfs.enable = '1' +if os.lfs.enable ~= nil then + local m = string.lower(os.lfs.enable) + if (m == '1' or m == 'yes' or m == 'true' or m == 't') then + os.lfs.status, os.lfs.pkg = pcall(require, 'lfs') + if os.lfs.status then + local lfs = os.lfs.pkg + os.path.exists = function (name) + return lfs.attributes(name) and true or false + end + os.path.isdir = function (name) + local mode = lfs.attributes(name) + if not mode then + return false + end + return (mode.mode == 'directory') and true or false end - return (mode.mode == 'directory') and true or false end end end