From 2035886fcd8c5a1a6406f9adfb84d1a4d78abdc9 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 | 2 +- 2 files changed, 2 insertions(+), 2 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 32212df8..c5e15707 100644 --- a/src/main.c +++ b/src/main.c @@ -222,7 +222,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" + " 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"