Fix some problems with user's directory
To accommodate the Window's platform prefer the USERPROFILE to HOME to set user's dir. Fix error, user's dir was not added to the package.path.
This commit is contained in:
parent
a337f893d9
commit
277186491a
13
src/main.c
13
src/main.c
|
@ -127,11 +127,14 @@ int main(int argc, char **argv) {
|
|||
" DATADIR = EXEDIR .. '/data'\n"
|
||||
" USERDIR = EXEDIR .. '/user'\n"
|
||||
#else
|
||||
" local prefix = EXEDIR:match(\"^(.+)[/\\\\]bin$\")\n"
|
||||
" DATADIR = prefix and (prefix .. '/share/lite-xl') or (EXEDIR .. '/data')\n"
|
||||
" USERDIR = os.getenv(\"HOME\") .. '/.config/lite-xl'\n"
|
||||
" package.path = package.path .. ';' .. DATADIR .. '/?.lua'\n"
|
||||
" package.path = package.path .. ';' .. DATADIR .. '/?/init.lua'\n"
|
||||
" do\n"
|
||||
" local prefix = EXEDIR:match(\"^(.+)[/\\\\]bin$\")\n"
|
||||
" DATADIR = prefix and (prefix .. '/share/lite-xl') or (EXEDIR .. '/data')\n"
|
||||
" local home = os.getenv('USERPROFILE') or os.getenv('HOME')\n"
|
||||
" USERDIR = home and home .. '/.config/lite-xl' or (EXEDIR .. '/user')\n"
|
||||
" end\n"
|
||||
" package.path = package.path .. ';' .. USERDIR .. '/?.lua'\n"
|
||||
" package.path = package.path .. ';' .. USERDIR .. '/?/init.lua'\n"
|
||||
#endif
|
||||
" package.path = DATADIR .. '/?.lua;' .. package.path\n"
|
||||
" package.path = DATADIR .. '/?/init.lua;' .. package.path\n"
|
||||
|
|
Loading…
Reference in New Issue