mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 02:44:56 +00:00
GOB: allow more path separators in "file path -> save handler" mapping
'/' and ':' are now supported in addition to Window-style '\'
This commit is contained in:
parent
bf652277aa
commit
a71b1c9e94
@ -33,14 +33,25 @@ SaveLoad::SaveLoad(GobEngine *vm) : _vm(vm) {
|
||||
SaveLoad::~SaveLoad() {
|
||||
}
|
||||
|
||||
const char *SaveLoad::stripPath(const char *fileName) {
|
||||
const char *SaveLoad::stripPath(const char *fileName, char separator) {
|
||||
const char *backSlash;
|
||||
if ((backSlash = strrchr(fileName, '\\')))
|
||||
if ((backSlash = strrchr(fileName, separator)))
|
||||
return backSlash + 1;
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
Common::String SaveLoad::replacePathSeparators(const char *path, char newSeparator) {
|
||||
Common::String result = path;
|
||||
for (char &c : result) {
|
||||
if (c != newSeparator && (c == '\\' || c == '/' || c == ':'))
|
||||
c = newSeparator;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Common::List<Common::String> SaveLoad::getFilesMatchingPattern(const char *pattern) const {
|
||||
warning("SaveLoad::getFilesMatchingPattern not implemented");
|
||||
return Common::List<Common::String>();
|
||||
|
@ -48,7 +48,10 @@ public:
|
||||
virtual ~SaveLoad();
|
||||
|
||||
/** "foo\bar\quux.bla" => "quux.bla". */
|
||||
static const char *stripPath(const char *fileName);
|
||||
static const char *stripPath(const char *fileName, char separator = '\\');
|
||||
|
||||
/** Changes all file separator characters (/,:,\) in path to newSeparator */
|
||||
static Common::String replacePathSeparators(const char *path, char newSeparator);
|
||||
|
||||
/** Returns how to handle that file. */
|
||||
virtual SaveMode getSaveMode(const char *fileName) const;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user