From 9284e922915f9bd3f77632d73f7686d338347c83 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 15 Feb 2023 20:48:09 -0500 Subject: [PATCH] Added in ability to specify prefix via env variable. (#1388) --- data/core/start.lua | 2 +- src/main.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/data/core/start.lua b/data/core/start.lua index bb10d7ef..2ad71d54 100644 --- a/data/core/start.lua +++ b/data/core/start.lua @@ -12,7 +12,7 @@ EXEDIR = EXEFILE:match("^(.+)[/\\][^/\\]+$") if MACOS_RESOURCES then DATADIR = MACOS_RESOURCES else - local prefix = 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') end USERDIR = (system.get_file_info(EXEDIR .. PATHSEP .. 'user') and (EXEDIR .. PATHSEP .. 'user')) diff --git a/src/main.c b/src/main.c index e6b5fb4d..1959e738 100644 --- a/src/main.c +++ b/src/main.c @@ -250,10 +250,7 @@ init_lua: "xpcall(function()\n" " HOME = os.getenv('" LITE_OS_HOME "')\n" " local exedir = EXEFILE:match('^(.*)" LITE_PATHSEP_PATTERN LITE_NONPATHSEP_PATTERN "$')\n" - " local prefix = exedir:match('^(.*)" LITE_PATHSEP_PATTERN "bin$')\n" - " if not HOME then\n" - " HOME = exedir\n" - " end\n" + " local prefix = os.getenv('LITE_PREFIX') or exedir:match('^(.*)" LITE_PATHSEP_PATTERN "bin$')\n" " dofile((MACOS_RESOURCES or (prefix and prefix .. '/share/lite-xl' or exedir .. '/data')) .. '/core/start.lua')\n" " core = require(os.getenv('LITE_XL_RUNTIME') or 'core')\n" " core.init()\n"