From cff6272c189364b44840964e8b322cc61a3855e6 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Sat, 6 May 2023 08:29:12 -0700 Subject: [PATCH] Always use absolute path for config.home_dir And by extension config.save_dir. This fixes an issue where paths retrieved by system.GetSaveFolderName and then passed to gamedir_path would become invalid. Fixes #115 --- src/system4.c | 4 ++-- subprojects/libsys4 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system4.c b/src/system4.c index cab5696..fadea60 100644 --- a/src/system4.c +++ b/src/system4.c @@ -224,7 +224,7 @@ static char *get_xsystem4_home(void) } // If all else fails, use the current directory - return xstrdup("."); + return realpath_utf8("."); } static char *get_save_path(const char *dir_name) @@ -491,7 +491,7 @@ int main(int argc, char *argv[]) if (argc < 1) { if (!config_init_with_dir(".")) { - if (!config_init_with_dir("../")) + if (!config_init_with_dir("..")) usage_error("Failed to find game in current or parent directory"); } } else if (argc > 1) { diff --git a/subprojects/libsys4 b/subprojects/libsys4 index 05b4cec..29d7356 160000 --- a/subprojects/libsys4 +++ b/subprojects/libsys4 @@ -1 +1 @@ -Subproject commit 05b4cec8a6085e8339d138fbde186873c849757b +Subproject commit 29d73563ecc9fac4716e5ffdb8bf0796cff37ccb