mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Save screenshots in home folder, Add functions for path separator and detection of homefolder to osinterface
This commit is contained in:
11
src/config.c
11
src/config.c
@@ -216,20 +216,23 @@ void config_save()
|
||||
*/
|
||||
void config_init()
|
||||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
char path[MAX_PATH];
|
||||
FILE* fp;
|
||||
|
||||
memcpy(&gGeneral_config, &gGeneral_config_default, sizeof(general_configuration_t));
|
||||
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, path))) { // find home folder
|
||||
strcat(path, "\\OpenRCT2");
|
||||
strncpy(path, osinterface_get_orct2_homefolder(), MAX_PATH);
|
||||
|
||||
if (strcmp(path, "") != 0){
|
||||
DWORD dwAttrib = GetFileAttributes(path);
|
||||
if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) { // folder does not exist
|
||||
if (!CreateDirectory(path, NULL)) {
|
||||
config_error("Could not create config file (do you have write access to your documents folder?)");
|
||||
}
|
||||
}
|
||||
strcat(path, "\\config.ini");
|
||||
|
||||
sprintf(path, "%s%c%s", path, osinterface_get_path_separator(), "config.ini");
|
||||
|
||||
fp = fopen(path, "r");
|
||||
if (!fp) {
|
||||
config_create_default(path);
|
||||
|
||||
Reference in New Issue
Block a user