Skip to content

Commit

Permalink
Always use absolute path for config.home_dir
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nunuhara committed May 6, 2023
1 parent e808d77 commit cff6272
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/system4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion subprojects/libsys4

0 comments on commit cff6272

Please sign in to comment.