ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

windows-saves.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
00024 
00025 #define WIN32_LEAN_AND_MEAN
00026 #include <windows.h>
00027 #if defined(__GNUC__) && defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
00028  // required for SHGFP_TYPE_CURRENT in shlobj.h
00029 #define _WIN32_IE 0x500
00030 #endif
00031 #include <shlobj.h>
00032 
00033 #include "common/scummsys.h"
00034 #include "common/config-manager.h"
00035 #include "backends/saves/windows/windows-saves.h"
00036 #include "backends/platform/sdl/win32/win32_wrapper.h"
00037 
00038 WindowsSaveFileManager::WindowsSaveFileManager() {
00039     char defaultSavepath[MAXPATHLEN];
00040 
00041 
00042     // Use the Application Data directory of the user profile.
00043     if (SHGetFolderPathFunc(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, defaultSavepath) == S_OK) {
00044         strcat(defaultSavepath, "\\ResidualVM");
00045         if (!CreateDirectory(defaultSavepath, NULL)) {
00046             if (GetLastError() != ERROR_ALREADY_EXISTS)
00047                 error("Cannot create ResidualVM application data folder");
00048         }
00049 
00050         strcat(defaultSavepath, "\\Saved games");
00051         if (!CreateDirectory(defaultSavepath, NULL)) {
00052             if (GetLastError() != ERROR_ALREADY_EXISTS)
00053                 error("Cannot create ResidualVM Saved games folder");
00054         }
00055 
00056         ConfMan.registerDefault("savepath", defaultSavepath);
00057     } else {
00058         warning("Unable to access application data directory");
00059     }
00060 }
00061 
00062 #endif


Generated on Sat Jul 20 2019 05:00:46 for ResidualVM by doxygen 1.7.1
curved edge   curved edge