From 4069ddc926e62a1d436ff577046e79d713159075 Mon Sep 17 00:00:00 2001 From: Justin Weiss Date: Wed, 22 Nov 2017 19:33:48 -0800 Subject: [PATCH] Expand symlinks in default configuration paths for iOS devices CFSearchPathForDirectoriesInDomains returns a path in /var, while getenv(HOME) returns the same path in /private/var. /var is a symlink to /private/var, but when config is generated, the difference in paths means they won't be abbreviated correctly. This change expands symlinks before filling in the default directories, so those paths will match. --- frontend/drivers/platform_darwin.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m index ee7ec7b7bb..df2ff6c28f 100644 --- a/frontend/drivers/platform_darwin.m +++ b/frontend/drivers/platform_darwin.m @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -335,6 +336,15 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[], CFSearchPathForDirectoriesInDomains(CFDocumentDirectory, CFUserDomainMask, 1, home_dir_buf, sizeof(home_dir_buf)); +#if TARGET_OS_IPHONE + char resolved_home_dir_buf[PATH_MAX_LENGTH] = {0}; + if (realpath(home_dir_buf, resolved_home_dir_buf)) { + retro_assert(strlcpy(home_dir_buf, + resolved_home_dir_buf, + sizeof(home_dir_buf)) < sizeof(home_dir_buf)); + } +#endif + strlcat(home_dir_buf, "/RetroArch", sizeof(home_dir_buf)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], home_dir_buf, "shaders_glsl",