mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-29 09:44:52 +01:00
Fix remaining code issues
This commit is contained in:
@@ -171,7 +171,7 @@ namespace Platform
|
||||
return path;
|
||||
}
|
||||
#elif defined (__ANDROID__)
|
||||
// Andorid builds currently only read from /sdcard/openrct2*
|
||||
// Android builds currently only read from /sdcard/openrct2*
|
||||
case SPECIAL_FOLDER::USER_CACHE:
|
||||
case SPECIAL_FOLDER::USER_CONFIG:
|
||||
case SPECIAL_FOLDER::USER_DATA:
|
||||
@@ -185,7 +185,7 @@ namespace Platform
|
||||
case SPECIAL_FOLDER::USER_HOME:
|
||||
{
|
||||
auto home = GetFolderPath(SPECIAL_FOLDER::USER_HOME);
|
||||
return Path::Combine(home, "/Library/Application Support");
|
||||
return Path::Combine(home, "Library/Application Support");
|
||||
}
|
||||
#else
|
||||
case SPECIAL_FOLDER::USER_CACHE:
|
||||
@@ -219,7 +219,22 @@ namespace Platform
|
||||
return path;
|
||||
}
|
||||
case SPECIAL_FOLDER::USER_HOME:
|
||||
return getpwuid(getuid())->pw_dir;
|
||||
{
|
||||
std::string path;
|
||||
auto pw = getpwuid(getuid());
|
||||
if (pw != nullptr)
|
||||
{
|
||||
path = pw->pw_dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
path = GetHomePathViaEnvironment();
|
||||
}
|
||||
if (path.empty())
|
||||
{
|
||||
return "/";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
return std::string();
|
||||
|
||||
@@ -56,26 +56,6 @@ void platform_get_exe_path(utf8 *outPath, size_t outSize)
|
||||
safe_strcpy(outPath, exePath, outSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default directory fallback is:
|
||||
* - (command line argument)
|
||||
* - ~/Library/Application Support/OpenRCT2
|
||||
*/
|
||||
void platform_posix_sub_user_data_path(char *buffer, size_t size, const char *homedir) {
|
||||
if (homedir == NULL)
|
||||
{
|
||||
log_fatal("Couldn't find user data directory");
|
||||
exit(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
safe_strcpy(buffer, homedir, size);
|
||||
safe_strcat_path(buffer, "Library", size);
|
||||
safe_strcat_path(buffer, "Application Support", size);
|
||||
safe_strcat_path(buffer, "OpenRCT2", size);
|
||||
path_end_with_separator(buffer, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default directory fallback is:
|
||||
* - (command line argument)
|
||||
|
||||
Reference in New Issue
Block a user