From 296bbe64d5f8ab16f6329af71ba33b391304ebf2 Mon Sep 17 00:00:00 2001 From: shenmo <47873776+shenmo7192@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:26:06 +0800 Subject: [PATCH 1/2] feat: try add BOX86_RCFILE support Make box86 support _RCFILE env like box64 https://github.com/ptitSeb/box64/blob/main/src/core.c#L1595 --- src/main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 19ec9b128..5ed3bd62e 100644 --- a/src/main.c +++ b/src/main.c @@ -1202,17 +1202,24 @@ static void add_argv(const char* what) { static void load_rcfiles() { + char* rcpath = getenv("BOX86_RCFILE"); + + if(rcpath && FileExist(rcpath, IS_FILE)) + LoadRCFile(rcpath); + #ifndef TERMUX - if(FileExist("/etc/box86.box86rc", IS_FILE)) + else if(FileExist("/etc/box86.box86rc", IS_FILE)) LoadRCFile("/etc/box86.box86rc"); #else - if(FileExist("/data/data/com.termux/files/usr/etc/box86.box86rc", IS_FILE)) + else if(FileExist("/data/data/com.termux/files/usr/etc/box86.box86rc", IS_FILE)) LoadRCFile("/data/data/com.termux/files/usr/etc/box86.box86rc"); #endif #ifdef PANDORA - if(FileExist("/mnt/utmp/codeblocks/usr/etc/box86.box86rc", IS_FILE)) + else if(FileExist("/mnt/utmp/codeblocks/usr/etc/box86.box86rc", IS_FILE)) LoadRCFile("/mnt/utmp/codeblocks/usr/etc/box86.box86rc"); #endif + else + LoadRCFile(NULL); // load default rcfile char* p = getenv("HOME"); if(p) { char tmp[4096]; From 4d5624ff185753235c614c06b134bc5b51fdb1d5 Mon Sep 17 00:00:00 2001 From: shenmo <47873776+shenmo7192@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:20:36 +0800 Subject: [PATCH 2/2] adjust: comment rcfile loading to avoid crash --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 5ed3bd62e..28ffed011 100644 --- a/src/main.c +++ b/src/main.c @@ -1218,8 +1218,8 @@ static void load_rcfiles() else if(FileExist("/mnt/utmp/codeblocks/usr/etc/box86.box86rc", IS_FILE)) LoadRCFile("/mnt/utmp/codeblocks/usr/etc/box86.box86rc"); #endif - else - LoadRCFile(NULL); // load default rcfile + // else + // LoadRCFile(NULL); // load default rcfile char* p = getenv("HOME"); if(p) { char tmp[4096];