First implementation of unix-like data directory

It basically works by setting the data directory to

$prefix/share/lite-xl

where $prefix is determined so that $prefix/bin corresponds to EXEDIR.

The packages 'user' and 'user.*' are loaded from the directory
'$HOME/.config/lite-xl'.
This commit is contained in:
Francesco Abbate
2020-12-02 00:23:15 +01:00
parent e9938862b5
commit 3589d7d3c0
6 changed files with 49 additions and 10 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ command.add(nil, {
end,
["core:open-user-module"] = function()
core.root_view:open_doc(core.open_doc(EXEDIR .. "/data/user/init.lua"))
core.root_view:open_doc(core.open_doc(USERDIR .. "/init.lua"))
end,
["core:open-project-module"] = function()
+2 -2
View File
@@ -94,7 +94,7 @@ function core.init()
CommandView = require "core.commandview"
Doc = require "core.doc"
local project_dir = EXEDIR
local project_dir = "."
local files = {}
for i = 2, #ARGS do
local info = system.get_file_info(ARGS[i]) or {}
@@ -187,7 +187,7 @@ end
function core.load_plugins()
local no_errors = true
local files = system.list_dir(EXEDIR .. "/data/plugins")
local files = system.list_dir(DATADIR .. "/plugins")
for _, filename in ipairs(files) do
local modname = "plugins." .. filename:gsub(".lua$", "")
local ok = core.try(require, modname)
+4 -4
View File
@@ -7,10 +7,10 @@ style.scrollbar_size = common.round(4 * SCALE)
style.caret_width = common.round(2 * SCALE)
style.tab_width = common.round(170 * SCALE)
style.font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 14 * SCALE)
style.big_font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 34 * SCALE)
style.icon_font = renderer.font.load(EXEDIR .. "/data/fonts/icons.ttf", 14 * SCALE)
style.code_font = renderer.font.load(EXEDIR .. "/data/fonts/monospace.ttf", 13.5 * SCALE)
style.font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 14 * SCALE)
style.big_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 34 * SCALE)
style.icon_font = renderer.font.load(DATADIR .. "/fonts/icons.ttf", 14 * SCALE)
style.code_font = renderer.font.load(DATADIR .. "/fonts/monospace.ttf", 13.5 * SCALE)
style.background = { common.color "#2e2e32" }
style.background2 = { common.color "#252529" }