Support portable user config(Fix #762)

This commit is contained in:
Jipok 2021-12-22 23:34:09 +05:00
parent 590c8bb456
commit a19baeacb1
1 changed files with 3 additions and 2 deletions

View File

@ -12,8 +12,9 @@ else
local prefix = EXEDIR:match("^(.+)[/\\]bin$")
DATADIR = prefix and (prefix .. '/share/lite-xl') or (EXEDIR .. '/data')
end
USERDIR = (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. "/lite-xl")
or (HOME and (HOME .. '/.config/lite-xl') or (EXEDIR .. '/user'))
USERDIR = (system.get_file_info(EXEDIR .. '/user') and (EXEDIR .. '/user'))
or ((os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. "/lite-xl"))
or (HOME and (HOME .. '/.config/lite-xl'))
package.path = DATADIR .. '/?.lua;' .. package.path
package.path = DATADIR .. '/?/init.lua;' .. package.path