Instead of having a separate start.lua.in file in the scripts directory and no start.lua file in data/core we use the file data/core/start.lua as a template for Meson to generate the final start.lua file for release. In this way people naturally trying to run lite-xl from the source folder will have a start.lua file albeit without a resolved version number. Otherwise, when using run-local script or the meson install command the meson-generated start.lua file will be used as it should be.
22 lines
815 B
Lua
22 lines
815 B
Lua
-- this file is used by lite-xl to setup the Lua environment when starting
|
|
VERSION = "@PROJECT_VERSION@"
|
|
MOD_VERSION = "1"
|
|
|
|
SCALE = tonumber(os.getenv("LITE_SCALE")) or SCALE
|
|
PATHSEP = package.config:sub(1, 1)
|
|
|
|
EXEDIR = EXEFILE:match("^(.+)[/\\][^/\\]+$")
|
|
if MACOS_RESOURCES then
|
|
DATADIR = MACOS_RESOURCES
|
|
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'))
|
|
|
|
package.path = DATADIR .. '/?.lua;' .. package.path
|
|
package.path = DATADIR .. '/?/init.lua;' .. package.path
|
|
package.path = USERDIR .. '/?.lua;' .. package.path
|
|
package.path = USERDIR .. '/?/init.lua;' .. package.path
|