Initial commit
This commit is contained in:
74
backends/saves/kolibrios/kolibrios-saves.cpp
Normal file
74
backends/saves/kolibrios/kolibrios-saves.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#if !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
|
||||
|
||||
#include "backends/saves/kolibrios/kolibrios-saves.h"
|
||||
#include "backends/fs/kolibrios/kolibrios-fs.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
KolibriOSSaveFileManager::KolibriOSSaveFileManager(const Common::Path& writeablePath) {
|
||||
// Register default savepath.
|
||||
Common::Path savePath;
|
||||
|
||||
if (KolibriOS::assureDirectoryExists("saves", writeablePath.toString().c_str())) {
|
||||
savePath = writeablePath.join("saves");
|
||||
}
|
||||
|
||||
if (!savePath.empty() && savePath.size() < MAXPATHLEN) {
|
||||
ConfMan.registerDefault("savepath", savePath);
|
||||
}
|
||||
|
||||
// The user can override the savepath with the SCUMMVM_SAVEPATH
|
||||
// environment variable. This is weaker than a --savepath on the
|
||||
// command line, but overrides the default savepath.
|
||||
//
|
||||
// To ensure that the command line option (if given) has precedence,
|
||||
// we only set the value in the transient domain if it is not
|
||||
// yet present there.
|
||||
if (!ConfMan.hasKey("savepath", Common::ConfigManager::kTransientDomain)) {
|
||||
const char *dir = getenv("SCUMMVM_SAVEPATH");
|
||||
if (dir && *dir && strlen(dir) < MAXPATHLEN) {
|
||||
Common::FSNode saveDir(dir);
|
||||
if (!saveDir.exists()) {
|
||||
warning("Ignoring non-existent SCUMMVM_SAVEPATH '%s'", dir);
|
||||
} else if (!saveDir.isWritable()) {
|
||||
warning("Ignoring non-writable SCUMMVM_SAVEPATH '%s'", dir);
|
||||
} else {
|
||||
ConfMan.setPath("savepath", dir, Common::ConfigManager::kTransientDomain);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
40
backends/saves/kolibrios/kolibrios-saves.h
Normal file
40
backends/saves/kolibrios/kolibrios-saves.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(BACKEND_KOLIBRIOS_SAVES_H) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
|
||||
#define BACKEND_KOLIBRIOS_SAVES_H
|
||||
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
|
||||
#if !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
|
||||
/**
|
||||
* Customization of the DefaultSaveFileManager for KolibriOS.
|
||||
* The only two differences are that the default constructor sets
|
||||
* up the savepath based on HOME, and that checkPath tries to
|
||||
* create the savedir, if missing, via the mkdir() syscall.
|
||||
*/
|
||||
class KolibriOSSaveFileManager : public DefaultSaveFileManager {
|
||||
public:
|
||||
KolibriOSSaveFileManager(const Common::Path& writeablePath);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user