100 | | GetWindowsDirectory(configFile, MAXPATHLEN); |
101 | | strcat(configFile, "\\" DEFAULT_CONFIG_FILE); |
| 100 | OSVERSIONINFO win32OsVersion; |
| 101 | ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO)); |
| 102 | win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
| 103 | GetVersionEx(&win32OsVersion); |
| 104 | // Check for non-9X version of Windows. |
| 105 | if (win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) { |
| 106 | // Use the Application Data directory of the user profile. |
| 107 | int bytesRead; |
| 108 | if (win32OsVersion.dwMajorVersion >= 5) |
| 109 | bytesRead = GetEnvironmentVariable("APPDATA", configFile, sizeof(configFile)); |
| 110 | else { |
| 111 | bytesRead = GetEnvironmentVariable("USERPROFILE", configFile, sizeof(configFile)); |
| 112 | if (bytesRead > 0) { |
| 113 | strcat(configFile, "\\Application Data"); |
| 114 | CreateDirectory(configFile, NULL); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | //Use APPDATA/USERPROFILE if found, otherwise fall back to Windows directory. |
| 119 | if (bytesRead > 0) { |
| 120 | strcat(configFile, "\\ScummVM"); |
| 121 | CreateDirectory(configFile, NULL); |
| 122 | strcat(configFile, "\\" DEFAULT_CONFIG_FILE); |
| 123 | } else { |
| 124 | error("Unable to access user profile directory"); |
| 125 | } |
| 126 | |
| 127 | if (fopen(configFile, "r") == NULL) { |
| 128 | char oldConfigFile[MAXPATHLEN]; |
| 129 | GetWindowsDirectory(oldConfigFile, MAXPATHLEN); |
| 130 | strcat(oldConfigFile, "\\" DEFAULT_CONFIG_FILE); |
| 131 | if (fopen(oldConfigFile, "r")) { |
| 132 | loadConfigFile(oldConfigFile); |
| 133 | // Insert GUI message here |
| 134 | } |
| 135 | } |
| 136 | } else { |
| 137 | // Check windows directory |
| 138 | GetWindowsDirectory(configFile, MAXPATHLEN); |
| 139 | strcat(configFile, "\\" DEFAULT_CONFIG_FILE); |
| 140 | } |
| 141 | |