Rodent IV on macOS: its home is its own folder, so it offers its personalities
Some checks failed
Rodent IV / build (rodent-iv-macos-arm64, macos-14) (push) Has been cancelled
Rodent IV / build (rodent-iv-windows-x86_64.exe, windows-latest) (push) Has been cancelled
Rodent IV / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rodent IV / build (rodent-iv-linux-x86_64, ubuntu-22.04) (push) Failing after 1s
Some checks failed
Rodent IV / build (rodent-iv-macos-arm64, macos-14) (push) Has been cancelled
Rodent IV / build (rodent-iv-windows-x86_64.exe, windows-latest) (push) Has been cancelled
Rodent IV / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rodent IV / build (rodent-iv-linux-x86_64, ubuntu-22.04) (push) Failing after 1s
On macOS the authors left the engine's home folder unset (a comment where _NSGetExecutablePath should be). With an empty home every folder was taken relative to the one it changed into last: reading basic.ini it went into personalities/ and found none of the personality files, so the Personality option was not offered and ChessPenguin's «Personality = Tal» was refused — «Rodent did not start». home-dir.patch now takes the executable's folder there too, as on Linux and Windows. Reproduced on Linux with the home left empty and checked with _NSGetExecutablePath shimmed: the play crate's Rodent IV game fails before and passes after. The workflow now checks that the engine, in a folder with a space and started from elsewhere, offers «Tal». Tasks: the Android screenshots done; two copies of the program put off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
12e4c7d5e9
commit
f8a2c6ffa3
3 changed files with 54 additions and 6 deletions
|
|
@ -1,8 +1,47 @@
|
|||
diff --git a/sources/src/rodenthome.cpp b/sources/src/rodenthome.cpp
|
||||
index 058cdaa..e8018b7 100755
|
||||
index 058cdaa..4bfcb2a 100755
|
||||
--- a/sources/src/rodenthome.cpp
|
||||
+++ b/sources/src/rodenthome.cpp
|
||||
@@ -199,7 +199,10 @@ void SetRodentHomeDir() {
|
||||
@@ -22,6 +22,11 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
+#if defined (__APPLE__)
|
||||
+ #include <limits.h>
|
||||
+ #include <stdlib.h>
|
||||
+ #include <mach-o/dyld.h>
|
||||
+#endif
|
||||
|
||||
#include "rodent.h"
|
||||
|
||||
@@ -174,9 +179,23 @@ void SetRodentHomeDir() {
|
||||
}
|
||||
|
||||
#elif defined (__APPLE__)
|
||||
- // #error something should be done here, look for _NSGetExecutablePath(path, &size)
|
||||
- // RodentHomeDirWStr = ...
|
||||
-
|
||||
+ // As on Linux: the home is the executable's folder (an empty home made every
|
||||
+ // folder relative to the one the engine changed into last, so no personality was
|
||||
+ // found and the Personality option was not offered).
|
||||
+ RodentHomeDirWStr = Str2WStr(GetEnv("RODENT4HOME"));
|
||||
+ if (RodentHomeDirWStr != L"") {
|
||||
+ PathEndSlash(RodentHomeDirWStr);
|
||||
+ printf_debug("override for home path: '%s'\n", WStr2Str(RodentHomeDirWStr).c_str());
|
||||
+ } else {
|
||||
+ char exe_path[PATH_MAX];
|
||||
+ char real_path[PATH_MAX];
|
||||
+ uint32_t size = sizeof(exe_path);
|
||||
+ if (_NSGetExecutablePath(exe_path, &size) == 0 && realpath(exe_path, real_path) != NULL) {
|
||||
+ *(strrchr(real_path, '/') + 1) = '\0';
|
||||
+ RodentHomeDirWStr = CStr2WStr(real_path);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
#elif defined (ANDROID)
|
||||
RodentHomeDirWStr = L"";
|
||||
|
||||
@@ -199,7 +218,10 @@ void SetRodentHomeDir() {
|
||||
} else {
|
||||
char exe_path[1024];
|
||||
// getting the current executable location ...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue