diff options
Diffstat (limited to 'backends/platform/sdl')
| -rw-r--r-- | backends/platform/sdl/sdl.cpp | 32 | 
1 files changed, 31 insertions, 1 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 5e09eaa957..9bebc63830 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -543,7 +543,37 @@ Common::WriteStream *OSystem_SDL::createLogFile() {  	Common::FSNode file(logFile);  	return file.createWriteStream();  #elif defined (WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) -	return 0; +	char logFile[MAXPATHLEN]; + +	OSVERSIONINFO win32OsVersion; +	ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO)); +	win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); +	GetVersionEx(&win32OsVersion); +	// Check for non-9X version of Windows. +	if (win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) { +		// Use the Application Data directory of the user profile. +		if (win32OsVersion.dwMajorVersion >= 5) { +			if (!GetEnvironmentVariable("APPDATA", logFile, sizeof(logFile))) +				error("Unable to access application data directory"); +		} else { +			if (!GetEnvironmentVariable("USERPROFILE", logFile, sizeof(logFile))) +				error("Unable to access user profile directory"); + +			strcat(logFile, "\\Application Data"); +			CreateDirectory(logFile, NULL); +		} + +		strcat(logFile, "\\ScummVM"); +		CreateDirectory(logFile, NULL); +		strcat(logFile, "\\Logs"); +		CreateDirectory(logFile, NULL); +		strcat(logFile, "\\" DEFAULT_LOG_FILE); + +		Common::FSNode file(logFile); +		return file.createWriteStream(); +	} else { +		return 0; +	}  #else  	return 0;  #endif  | 
