2021-05-27 13:46:51 +02:00
|
|
|
-- this file is used by lite-xl to setup the Lua environment when starting
|
2021-08-09 19:32:53 +02:00
|
|
|
VERSION = "@PROJECT_VERSION@"
|
2021-08-19 23:37:03 +02:00
|
|
|
MOD_VERSION = "2"
|
2021-02-24 16:29:39 +01:00
|
|
|
|
|
|
|
SCALE = tonumber(os.getenv("LITE_SCALE")) or SCALE
|
|
|
|
PATHSEP = package.config:sub(1, 1)
|
|
|
|
|
2021-04-18 17:51:31 +02:00
|
|
|
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
|
2021-06-28 16:44:40 +02:00
|
|
|
USERDIR = (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. "/lite-xl")
|
|
|
|
or (HOME and (HOME .. '/.config/lite-xl') or (EXEDIR .. '/user'))
|
2021-02-24 16:29:39 +01:00
|
|
|
|
|
|
|
package.path = DATADIR .. '/?.lua;' .. package.path
|
|
|
|
package.path = DATADIR .. '/?/init.lua;' .. package.path
|
2021-03-03 12:20:22 +01:00
|
|
|
package.path = USERDIR .. '/?.lua;' .. package.path
|
|
|
|
package.path = USERDIR .. '/?/init.lua;' .. package.path
|
2021-09-16 18:37:17 +02:00
|
|
|
|
2021-10-03 17:22:05 +02:00
|
|
|
if system.load_native_plugin then
|
|
|
|
local dynamic_suffix = PLATFORM == "Mac OS X" and 'lib' or (PLATFORM == "Windows" and 'dll' or 'so')
|
|
|
|
package.cpath = DATADIR .. '/?.' .. dynamic_suffix .. ";" .. USERDIR .. '/?.' .. dynamic_suffix
|
|
|
|
package.native_plugins = {}
|
|
|
|
package.searchers = { package.searchers[1], package.searchers[2], function(modname)
|
|
|
|
local path = package.searchpath(modname, package.cpath)
|
|
|
|
if not path then return nil end
|
|
|
|
return system.load_native_plugin, path
|
|
|
|
end }
|
|
|
|
end
|