More path fixes

This commit is contained in:
George Sokianos 2024-02-18 21:31:24 +00:00
parent 9c2eec9066
commit 7efe75fe7d
3 changed files with 4 additions and 4 deletions

View File

@ -610,7 +610,7 @@ end
---@param path string ---@param path string
---@return boolean ---@return boolean
function common.is_absolute_path(path) function common.is_absolute_path(path)
return path:sub(1, 1) == PATHSEP or path:match("^(%a):\\") or path:match('^(%w*):') return path:sub(1, 1) == PATHSEP or path:match("^(%a):\\") or path:match('^([%w%s]*):')
end end

View File

@ -97,7 +97,7 @@ function dirwatch:check(change_callback, scan_time, wait_time)
if self.monitor:mode() == "single" then if self.monitor:mode() == "single" then
local path = common.dirname(id) local path = common.dirname(id)
if not string.match(id, "^/") and not string.match(id, "^%a:[/\\]") then if not string.match(id, "^/") and not string.match(id, "^%a:[/\\]") then
path = common.dirname(common.basepath(self.single_watch_top) .. id) path = common.dirname(self.single_watch_top .. PATHSEP .. id)
end end
change_callback(path) change_callback(path)
elseif self.reverse_watched[id] then elseif self.reverse_watched[id] then

View File

@ -5,11 +5,11 @@ MOD_VERSION = "3"
SCALE = tonumber(os.getenv("LITE_SCALE") or os.getenv("GDK_SCALE") or os.getenv("QT_SCALE_FACTOR")) or 1 SCALE = tonumber(os.getenv("LITE_SCALE") or os.getenv("GDK_SCALE") or os.getenv("QT_SCALE_FACTOR")) or 1
PATHSEP = package.config:sub(1, 1) PATHSEP = package.config:sub(1, 1)
EXEDIR = EXEFILE:match("^(.+)[:/\\][^/\\]+$") EXEDIR = EXEFILE:match("^(.+)[/\\][^/\\]+$")
if MACOS_RESOURCES then if MACOS_RESOURCES then
DATADIR = MACOS_RESOURCES DATADIR = MACOS_RESOURCES
else else
local prefix = os.getenv('LITE_PREFIX') or EXEDIR:match("^(.+)[:/\\]bin$") local prefix = os.getenv('LITE_PREFIX') or EXEDIR:match("^(.+)[/\\]bin$")
DATADIR = prefix and (prefix .. PATHSEP .. 'share' .. PATHSEP .. 'lite-xl') or (EXEDIR .. PATHSEP .. 'data') DATADIR = prefix and (prefix .. PATHSEP .. 'share' .. PATHSEP .. 'lite-xl') or (EXEDIR .. PATHSEP .. 'data')
end end