diff options
| author | olegos2 <74909582+olegos2@users.noreply.github.com> | 2024-03-28 23:08:53 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-28 21:08:53 +0100 |
| commit | da64a3eeab26ddc1ebbe2d38054adce959375714 (patch) | |
| tree | a344815fa705d23c3a4ae15c36dcc4f9eeb3395c | |
| parent | 912622bf1f3db7f3cba32b44f4f1c106e3fb7dbf (diff) | |
| download | box64-da64a3eeab26ddc1ebbe2d38054adce959375714.tar.gz box64-da64a3eeab26ddc1ebbe2d38054adce959375714.zip | |
Add BOX64_RCFILE variable (#1392)
* Implement BOX64_RCFILE * Update USAGE.md * Should fix tests
| -rw-r--r-- | docs/USAGE.md | 3 | ||||
| -rw-r--r-- | src/core.c | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/docs/USAGE.md b/docs/USAGE.md index 5981a2aa..b28284fc 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -343,6 +343,9 @@ Define x86_64 bash to launch script #### BOX64_NORCFILES If the env var exist, no rc files (like /etc/box64.box64rc and ~/.box64rc) will be loaded +#### BOX64_RCFILE +If the env var is set and file exists, this variable will be used as path to the box64rc file instead of default paths (BOX64_RCFILE is loaded first, default paths are not loaded) + ---- Those variables are only valid inside a rcfile: diff --git a/src/core.c b/src/core.c index 5bfc9810..187e5395 100644 --- a/src/core.c +++ b/src/core.c @@ -1559,18 +1559,22 @@ static void add_argv(const char* what) { static void load_rcfiles() { + char* rcpath = getenv("BOX64_RCFILE"); + + if(rcpath && FileExist(rcpath, IS_FILE)) + LoadRCFile(rcpath); #ifndef TERMUX - if(FileExist("/etc/box64.box64rc", IS_FILE)) + else if(FileExist("/etc/box64.box64rc", IS_FILE)) LoadRCFile("/etc/box64.box64rc"); else if(FileExist("/data/data/com.termux/files/usr/glibc/etc/box64.box64rc", IS_FILE)) LoadRCFile("/data/data/com.termux/files/usr/glibc/etc/box64.box64rc"); #else - if(FileExist("/data/data/com.termux/files/usr/etc/box64.box64rc", IS_FILE)) + else if(FileExist("/data/data/com.termux/files/usr/etc/box64.box64rc", IS_FILE)) LoadRCFile("/data/data/com.termux/files/usr/etc/box64.box64rc"); #endif - else LoadRCFile(NULL); // load default rcfile + char* p = getenv("HOME"); if(p) { char tmp[4096]; @@ -2177,4 +2181,4 @@ int emulate(x64emu_t* emu, elfheader_t* elf_header) #endif return ret; -} \ No newline at end of file +} |