Improve the implementation of unix-like directories usage

Add a Meson option "portable" to choose between "portable" and unix-like
directories. Add information about this option in the README.

To determine the user's directory use the variable USERPROFILE only on
Windows and use HOME otherwise.

Implement the "portable" option in the package build script.
This commit is contained in:
Francesco Abbate
2020-12-03 16:46:18 +01:00
parent 277186491a
commit c41dedafad
5 changed files with 102 additions and 37 deletions
+6 -2
View File
@@ -129,9 +129,13 @@ int main(int argc, char **argv) {
#else
" do\n"
" local prefix = EXEDIR:match(\"^(.+)[/\\\\]bin$\")\n"
#ifdef _WIN32
" local home = os.getenv('USERPROFILE')\n"
#else
" local home = os.getenv('HOME')\n"
#endif
" 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"
" 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"