From 642bfeb44e08185c30df2be01a423d9e2e39ef94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 27 May 2016 21:40:12 +0200 Subject: [PATCH] Ensure user directory exists when specifying custom path This is done anyway in openrct2.c:openrct2_initialise(), but we will have wrong custom user data path by then. --- src/platform/posix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/posix.c b/src/platform/posix.c index 77d59ca6db..ec9f69f7c1 100644 --- a/src/platform/posix.c +++ b/src/platform/posix.c @@ -662,6 +662,10 @@ void platform_resolve_user_data_path() const char separator[2] = { platform_get_path_separator(), 0 }; if (gCustomUserDataPath[0] != 0) { + if (!platform_ensure_directory_exists(gCustomUserDataPath)) { + log_error("Failed to create directory \"%s\", make sure you have permissions.", gCustomUserDataPath); + return; + } if (realpath(gCustomUserDataPath, _userDataDirectoryPath) == NULL) { log_error("Could not resolve path \"%s\"", gCustomUserDataPath); return;