diff options
author | Cameron Cawley | 2019-08-04 21:45:17 +0100 |
---|---|---|
committer | Filippos Karapetis | 2019-08-05 10:01:30 +0300 |
commit | 8b8fb6d3a4748ded6f47cf057fc22f9aeab225d0 (patch) | |
tree | 363e8777d147e90a75ece84e6aca42be60697dc6 /backends/platform/sdl/win32 | |
parent | d10c69d0d1c596d4ecce9cbf967c75f3cf95a47b (diff) | |
download | scummvm-rg350-8b8fb6d3a4748ded6f47cf057fc22f9aeab225d0.tar.gz scummvm-rg350-8b8fb6d3a4748ded6f47cf057fc22f9aeab225d0.tar.bz2 scummvm-rg350-8b8fb6d3a4748ded6f47cf057fc22f9aeab225d0.zip |
SDL: Simplify implementation of createLogFile()
Diffstat (limited to 'backends/platform/sdl/win32')
-rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 31 | ||||
-rw-r--r-- | backends/platform/sdl/win32/win32.h | 12 |
2 files changed, 12 insertions, 31 deletions
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index a116e71e76..cb65fa813a 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -278,31 +278,22 @@ Common::String OSystem_Win32::getDefaultConfigFileName() { return configFile; } -Common::WriteStream *OSystem_Win32::createLogFile() { - // Start out by resetting _logFilePath, so that in case - // of a failure, we know that no log file is open. - _logFilePath.clear(); - +Common::String OSystem_Win32::getDefaultLogFileName() { char logFile[MAXPATHLEN]; // Use the Application Data directory of the user profile. - if (SHGetFolderPathFunc(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, logFile) == S_OK) { - strcat(logFile, "\\ScummVM"); - CreateDirectory(logFile, NULL); - strcat(logFile, "\\Logs"); - CreateDirectory(logFile, NULL); - strcat(logFile, "\\scummvm.log"); - - Common::FSNode file(logFile); - Common::WriteStream *stream = file.createWriteStream(); - if (stream) - _logFilePath= logFile; - - return stream; - } else { + if (SHGetFolderPathFunc(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, logFile) != S_OK) { warning("Unable to access application data directory"); - return 0; + return Common::String(); } + + strcat(logFile, "\\ScummVM"); + CreateDirectory(logFile, NULL); + strcat(logFile, "\\Logs"); + CreateDirectory(logFile, NULL); + strcat(logFile, "\\scummvm.log"); + + return logFile; } namespace { diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h index 9919495e37..050137ffe1 100644 --- a/backends/platform/sdl/win32/win32.h +++ b/backends/platform/sdl/win32/win32.h @@ -46,18 +46,8 @@ public: virtual Common::String getScreenshotsPath(); protected: - /** - * The path of the currently open log file, if any. - * - * @note This is currently a string and not an FSNode for simplicity; - * e.g. we don't need to include fs.h here, and currently the - * only use of this value is to use it to open the log file in an - * editor; for that, we need it only as a string anyway. - */ - Common::String _logFilePath; - virtual Common::String getDefaultConfigFileName(); - virtual Common::WriteStream *createLogFile(); + virtual Common::String getDefaultLogFileName(); // Override createAudioCDManager() to get our Mac-specific // version. |