[Scummvm-cvs-logs] SF.net SVN: scummvm:[54490] scummvm/trunk/backends/platform/sdl/sdl.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Fri Nov 26 01:52:04 CET 2010
Revision: 54490
http://scummvm.svn.sourceforge.net/scummvm/?rev=54490&view=rev
Author: lordhoto
Date: 2010-11-26 00:52:04 +0000 (Fri, 26 Nov 2010)
Log Message:
-----------
SDL: Hook up file logger to log on Windows.
For now the log file will be either "%APPDATA%/ScummVM/Logs/scummvm.log" or
"%USERPROFILE%/Application Data/ScummVM/Logs/scummvm.log" to match the
location of the default ScummVM configuration file.
Modified Paths:
--------------
scummvm/trunk/backends/platform/sdl/sdl.cpp
Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp 2010-11-26 00:51:42 UTC (rev 54489)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp 2010-11-26 00:52:04 UTC (rev 54490)
@@ -543,7 +543,37 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list