diff options
-rw-r--r-- | backends/fs/abstract-fs.h | 2 | ||||
-rw-r--r-- | backends/plugins/dc/dc-provider.cpp | 6 | ||||
-rw-r--r-- | backends/plugins/posix/posix-provider.cpp | 6 | ||||
-rw-r--r-- | backends/plugins/sdl/sdl-provider.cpp | 6 | ||||
-rw-r--r-- | backends/plugins/win32/win32-provider.cpp | 6 | ||||
-rw-r--r-- | base/commandLine.cpp | 2 | ||||
-rw-r--r-- | common/advancedDetector.cpp | 6 | ||||
-rw-r--r-- | common/file.cpp | 14 | ||||
-rw-r--r-- | common/fs.cpp | 106 | ||||
-rw-r--r-- | common/fs.h | 48 | ||||
-rw-r--r-- | common/md5.cpp | 2 | ||||
-rw-r--r-- | engines/agi/agi_v3.cpp | 6 | ||||
-rw-r--r-- | engines/agi/detection.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/resource.cpp | 10 | ||||
-rw-r--r-- | engines/queen/queen.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 10 | ||||
-rw-r--r-- | engines/sky/sky.cpp | 6 | ||||
-rw-r--r-- | engines/sword1/sword1.cpp | 6 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 8 | ||||
-rw-r--r-- | gui/browser.cpp | 10 | ||||
-rw-r--r-- | gui/launcher.cpp | 16 | ||||
-rw-r--r-- | gui/massadd.cpp | 6 | ||||
-rw-r--r-- | gui/options.cpp | 10 | ||||
-rw-r--r-- | gui/themebrowser.cpp | 6 |
24 files changed, 160 insertions, 142 deletions
diff --git a/backends/fs/abstract-fs.h b/backends/fs/abstract-fs.h index 519337a486..bb7669739f 100644 --- a/backends/fs/abstract-fs.h +++ b/backends/fs/abstract-fs.h @@ -79,7 +79,7 @@ public: virtual ~AbstractFilesystemNode() {} /* - * Indicates whether this path exists in the filesystem or not. + * Indicates whether the object refered by this path exists in the filesystem or not. */ virtual bool exists() const = 0; diff --git a/backends/plugins/dc/dc-provider.cpp b/backends/plugins/dc/dc-provider.cpp index 166852655b..db0242f7d8 100644 --- a/backends/plugins/dc/dc-provider.cpp +++ b/backends/plugins/dc/dc-provider.cpp @@ -114,14 +114,14 @@ PluginList DCPluginProvider::getPlugins() { // Scan for all plugins in this directory FilesystemNode dir(PLUGIN_DIRECTORY); FSList files; - if (!dir.listDir(files, FilesystemNode::kListFilesOnly)) { + if (!dir.getChildren(files, FilesystemNode::kListFilesOnly)) { error("Couldn't open plugin directory '%s'", PLUGIN_DIRECTORY); } for (FSList::const_iterator i = files.begin(); i != files.end(); ++i) { - Common::String name(i->name()); + Common::String name(i->getName()); if (name.hasPrefix(PLUGIN_PREFIX) && name.hasSuffix(PLUGIN_SUFFIX)) { - pl.push_back(new DCPlugin(i->path())); + pl.push_back(new DCPlugin(i->getPath())); } } diff --git a/backends/plugins/posix/posix-provider.cpp b/backends/plugins/posix/posix-provider.cpp index ce319840a4..03ee1c204f 100644 --- a/backends/plugins/posix/posix-provider.cpp +++ b/backends/plugins/posix/posix-provider.cpp @@ -107,14 +107,14 @@ PluginList POSIXPluginProvider::getPlugins() { // Scan for all plugins in this directory FilesystemNode dir(PLUGIN_DIRECTORY); FSList files; - if (!dir.listDir(files, FilesystemNode::kListFilesOnly)) { + if (!dir.getChildren(files, FilesystemNode::kListFilesOnly)) { error("Couldn't open plugin directory '%s'", PLUGIN_DIRECTORY); } for (FSList::const_iterator i = files.begin(); i != files.end(); ++i) { - Common::String name(i->name()); + Common::String name(i->getName()); if (name.hasPrefix(PLUGIN_PREFIX) && name.hasSuffix(PLUGIN_SUFFIX)) { - pl.push_back(new POSIXPlugin(i->path())); + pl.push_back(new POSIXPlugin(i->getPath())); } } diff --git a/backends/plugins/sdl/sdl-provider.cpp b/backends/plugins/sdl/sdl-provider.cpp index 0f67c9a691..cb09af20ca 100644 --- a/backends/plugins/sdl/sdl-provider.cpp +++ b/backends/plugins/sdl/sdl-provider.cpp @@ -107,14 +107,14 @@ PluginList SDLPluginProvider::getPlugins() { // Scan for all plugins in this directory FilesystemNode dir(PLUGIN_DIRECTORY); FSList files; - if (!dir.listDir(files, FilesystemNode::kListFilesOnly)) { + if (!dir.getChildren(files, FilesystemNode::kListFilesOnly)) { error("Couldn't open plugin directory '%s'", PLUGIN_DIRECTORY); } for (FSList::const_iterator i = files.begin(); i != files.end(); ++i) { - Common::String name(i->name()); + Common::String name(i->getName()); if (name.hasPrefix(PLUGIN_PREFIX) && name.hasSuffix(PLUGIN_SUFFIX)) { - pl.push_back(new SDLPlugin(i->path())); + pl.push_back(new SDLPlugin(i->getPath())); } } diff --git a/backends/plugins/win32/win32-provider.cpp b/backends/plugins/win32/win32-provider.cpp index eeea3b805c..b340c23709 100644 --- a/backends/plugins/win32/win32-provider.cpp +++ b/backends/plugins/win32/win32-provider.cpp @@ -110,14 +110,14 @@ PluginList Win32PluginProvider::getPlugins() { // Scan for all plugins in this directory FilesystemNode dir(PLUGIN_DIRECTORY); FSList files; - if (!dir.listDir(files, FilesystemNode::kListFilesOnly)) { + if (!dir.getChildren(files, FilesystemNode::kListFilesOnly)) { error("Couldn't open plugin directory '%s'", PLUGIN_DIRECTORY); } for (FSList::const_iterator i = files.begin(); i != files.end(); ++i) { - Common::String name(i->name()); + Common::String name(i->getName()); if (name.hasPrefix(PLUGIN_PREFIX) && name.hasSuffix(PLUGIN_SUFFIX)) { - pl.push_back(new Win32Plugin(i->path())); + pl.push_back(new Win32Plugin(i->getPath())); } } diff --git a/base/commandLine.cpp b/base/commandLine.cpp index b273e50f81..3d826e2fa0 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -562,7 +562,7 @@ static void runDetectorTest() { FilesystemNode dir(path); FSList files; - if (!dir.listDir(files, FilesystemNode::kListAll)) { + if (!dir.getChildren(files, FilesystemNode::kListAll)) { printf(" ... invalid path, skipping\n"); continue; } diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 24e884a164..d6b622451a 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -227,7 +227,7 @@ PluginError detectGameForEngineCreation( FSList fslist; FilesystemNode dir(ConfMan.get("path")); - if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) { return kInvalidPathError; } @@ -285,7 +285,7 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p // Get the information of the existing files for (FSList::const_iterator file = fslist->begin(); file != fslist->end(); ++file) { if (file->isDirectory()) continue; - tstr = file->name(); + tstr = file->getName(); tstr.toLowercase(); // Strip any trailing dot @@ -304,7 +304,7 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p debug(3, "> %s: %s", tstr.c_str(), md5str); - if (testFile.open(file->path())) { + if (testFile.open(file->getPath())) { filesSize[tstr] = (int32)testFile.size(); testFile.close(); } diff --git a/common/file.cpp b/common/file.cpp index 2eba1bcb3d..c04c579535 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -226,7 +226,7 @@ void File::addDefaultDirectoryRecursive(const FilesystemNode &dir, int level, co return; FSList fslist; - if (!dir.listDir(fslist, FilesystemNode::kListAll)) { + if (!dir.getChildren(fslist, FilesystemNode::kListAll)) { // Failed listing the contents of this node, so it is either not a // directory, or just doesn't exist at all. return; @@ -237,7 +237,7 @@ void File::addDefaultDirectoryRecursive(const FilesystemNode &dir, int level, co // Do not add directories multiple times, unless this time they are added // with a bigger depth. - const String &directory(dir.path()); + const String &directory(dir.getPath()); if (_defaultDirectories->contains(directory) && (*_defaultDirectories)[directory] >= level) return; (*_defaultDirectories)[directory] = level; @@ -247,13 +247,13 @@ void File::addDefaultDirectoryRecursive(const FilesystemNode &dir, int level, co for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (file->isDirectory()) { - addDefaultDirectoryRecursive(file->path(), level - 1, prefix + file->name() + "/"); + addDefaultDirectoryRecursive(file->getPath(), level - 1, prefix + file->getName() + "/"); } else { String lfn(prefix); - lfn += file->name(); + lfn += file->getName(); lfn.toLowercase(); if (!_filesMap->contains(lfn)) { - (*_filesMap)[lfn] = file->path(); + (*_filesMap)[lfn] = file->getPath(); } } } @@ -372,7 +372,7 @@ bool File::open(const FilesystemNode &node, AccessMode mode) { return false; } - String filename(node.name()); + String filename(node.getName()); if (_handle) { error("File::open: This file object already is opened (%s), won't open '%s'", _name.c_str(), filename.c_str()); @@ -383,7 +383,7 @@ bool File::open(const FilesystemNode &node, AccessMode mode) { const char *modeStr = (mode == kFileReadMode) ? "rb" : "wb"; - _handle = fopen(node.path().c_str(), modeStr); + _handle = fopen(node.getPath().c_str(), modeStr); if (_handle == NULL) { if (mode == kFileReadMode) diff --git a/common/fs.cpp b/common/fs.cpp index ef106c2488..fdc485a06f 100644 --- a/common/fs.cpp +++ b/common/fs.cpp @@ -27,16 +27,16 @@ #include "backends/fs/abstract-fs.h" #include "backends/fs/fs-factory-maker.cpp" -FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode) { - _realNode = realNode; - _refCount = new int(1); -} - FilesystemNode::FilesystemNode() { _realNode = 0; _refCount = 0; } +FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode) { + _realNode = realNode; + _refCount = new int(1); +} + FilesystemNode::FilesystemNode(const FilesystemNode &node) { _realNode = node._realNode; _refCount = node._refCount; @@ -58,17 +58,6 @@ FilesystemNode::~FilesystemNode() { decRefCount(); } -void FilesystemNode::decRefCount() { - if (_refCount) { - assert(*_refCount > 0); - --(*_refCount); - if (*_refCount == 0) { - delete _refCount; - delete _realNode; - } - } -} - FilesystemNode &FilesystemNode::operator= (const FilesystemNode &node) { if (node._refCount) ++(*node._refCount); @@ -81,24 +70,32 @@ FilesystemNode &FilesystemNode::operator= (const FilesystemNode &node) { return *this; } -bool FilesystemNode::isValid() const { - if (_realNode == 0) +bool FilesystemNode::operator< (const FilesystemNode& node) const +{ + if (isDirectory() && !node.isDirectory()) + return true; + if (!isDirectory() && node.isDirectory()) return false; - return _realNode->isValid(); + return scumm_stricmp(getDisplayName().c_str(), node.getDisplayName().c_str()) < 0; } -FilesystemNode FilesystemNode::getParent() const { - if (_realNode == 0) - return *this; - - AbstractFilesystemNode *node = _realNode->getParent(); - if (node == 0) { - return *this; - } else { - return FilesystemNode(node); +void FilesystemNode::decRefCount() { + if (_refCount) { + assert(*_refCount > 0); + --(*_refCount); + if (*_refCount == 0) { + delete _refCount; + delete _realNode; + } } } +bool FilesystemNode::exists() const { + if (_realNode == 0) + return false; + return _realNode->exists(); +} + FilesystemNode FilesystemNode::getChild(const Common::String &n) const { if (_realNode == 0) return *this; @@ -108,7 +105,7 @@ FilesystemNode FilesystemNode::getChild(const Common::String &n) const { return FilesystemNode(node); } -bool FilesystemNode::listDir(FSList &fslist, ListMode mode) const { +bool FilesystemNode::getChildren(FSList &fslist, ListMode mode) const { if (!_realNode || !_realNode->isDirectory()) return false; @@ -125,32 +122,53 @@ bool FilesystemNode::listDir(FSList &fslist, ListMode mode) const { return true; } -bool FilesystemNode::isDirectory() const { - if (_realNode == 0) - return false; - return _realNode->isDirectory(); -} - -Common::String FilesystemNode::displayName() const { +Common::String FilesystemNode::getDisplayName() const { assert(_realNode); return _realNode->getDisplayName(); } -Common::String FilesystemNode::name() const { +Common::String FilesystemNode::getName() const { assert(_realNode); return _realNode->getName(); } -Common::String FilesystemNode::path() const { +FilesystemNode FilesystemNode::getParent() const { + if (_realNode == 0) + return *this; + + AbstractFilesystemNode *node = _realNode->getParent(); + if (node == 0) { + return *this; + } else { + return FilesystemNode(node); + } +} + +Common::String FilesystemNode::getPath() const { assert(_realNode); return _realNode->getPath(); } -bool FilesystemNode::operator< (const FilesystemNode& node) const -{ - if (isDirectory() && !node.isDirectory()) - return true; - if (!isDirectory() && node.isDirectory()) +bool FilesystemNode::isDirectory() const { + if (_realNode == 0) + return false; + return _realNode->isDirectory(); +} + +bool FilesystemNode::isReadable() const { + if (_realNode == 0) + return false; + return _realNode->isReadable(); +} + +bool FilesystemNode::isValid() const { + if (_realNode == 0) + return false; + return _realNode->isValid(); +} + +bool FilesystemNode::isWritable() const { + if (_realNode == 0) return false; - return scumm_stricmp(displayName().c_str(), node.displayName().c_str()) < 0; + return _realNode->isWritable(); } diff --git a/common/fs.h b/common/fs.h index c78980a813..6b0a587e1b 100644 --- a/common/fs.h +++ b/common/fs.h @@ -119,18 +119,34 @@ public: */ bool operator< (const FilesystemNode& node) const; + /* + * Indicates whether the object refered by this path exists in the filesystem or not. + */ + virtual bool exists() const; + + /** + * Fetch a child node of this node, with the given name. Only valid for + * directory nodes (an assertion is triggered otherwise). + * If no child node with the given name exists, an invalid node is returned. + */ + FilesystemNode getChild(const Common::String &name) const; + + /** + * Return a list of child nodes of this directory node. If called on a node + * that does not represent a directory, false is returned. + * + * @return true if succesful, false otherwise (e.g. when the directory does not exist). + * @todo Rename this to listChildren or getChildren. + */ + virtual bool getChildren(FSList &fslist, ListMode mode = kListDirectoriesOnly) const; + /** * Return a human readable string for this node, usable for display (e.g. * in the GUI code). Do *not* rely on it being usable for anything else, * like constructing paths! * @return the display name */ - virtual Common::String displayName() const; - - /* - * Indicates whether the object refered by this path exists in the filesystem or not. - */ - virtual bool exists() const; + virtual Common::String getDisplayName() const; /** * Return a string representation of the name of the file. This is can be @@ -140,7 +156,7 @@ public: * * @return the file name */ - virtual Common::String name() const; + virtual Common::String getName() const; /** * Return a string representation of the file which can be passed to fopen(), @@ -153,23 +169,7 @@ public: * * @return the 'path' represented by this filesystem node */ - virtual Common::String path() const; - - /** - * Fetch a child node of this node, with the given name. Only valid for - * directory nodes (an assertion is triggered otherwise). - * If no child node with the given name exists, an invalid node is returned. - */ - FilesystemNode getChild(const Common::String &name) const; - - /** - * Return a list of child nodes of this directory node. If called on a node - * that does not represent a directory, false is returned. - * - * @return true if succesful, false otherwise (e.g. when the directory does not exist). - * @todo Rename this to listChildren or getChildren. - */ - virtual bool listDir(FSList &fslist, ListMode mode = kListDirectoriesOnly) const; + virtual Common::String getPath() const; /** * Get the parent node of this node. If this node has no parent node, diff --git a/common/md5.cpp b/common/md5.cpp index a48ecb4948..35fbe0b9ab 100644 --- a/common/md5.cpp +++ b/common/md5.cpp @@ -254,7 +254,7 @@ bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length) { return false; } - return md5_file(file.path().c_str(), digest, length); + return md5_file(file.getPath().c_str(), digest, length); } bool md5_file(const char *name, uint8 digest[16], uint32 length) { diff --git a/engines/agi/agi_v3.cpp b/engines/agi/agi_v3.cpp index 3e90dc11f1..33f670e779 100644 --- a/engines/agi/agi_v3.cpp +++ b/engines/agi/agi_v3.cpp @@ -52,14 +52,14 @@ int AgiLoader_v3::detectGame() { FSList fslist; FilesystemNode dir(ConfMan.get("path")); - if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { - warning("AgiEngine: invalid game path '%s'", dir.path().c_str()); + if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) { + warning("AgiEngine: invalid game path '%s'", dir.getPath().c_str()); return errInvalidAGIFile; } for (FSList::const_iterator file = fslist.begin(); file != fslist.end() && !found; ++file) { - Common::String f = file->name(); + Common::String f = file->getName(); f.toLowercase(); if (f.hasSuffix("vol.0")) { diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 9f6f0e7156..b7f8c12730 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -1885,7 +1885,7 @@ Common::ADGameDescList fallbackDetector(const FSList *fslist) { // First grab all filenames for (FSList::const_iterator file = fslist->begin(); file != fslist->end(); ++file) { if (file->isDirectory()) continue; - tstr = file->name(); + tstr = file->getName(); tstr.toLowercase(); allFiles[tstr] = true; diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 7c15cee2f9..319845c22c 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -82,8 +82,8 @@ Resource::Resource(KyraEngine *vm) { FSList fslist; FilesystemNode dir(ConfMan.get("path")); - if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) - error("invalid game path '%s'", dir.path().c_str()); + if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) + error("invalid game path '%s'", dir.getPath().c_str()); if (_vm->game() == GI_KYRA1 && _vm->gameFlags().isTalkie) { static const char *list[] = { @@ -96,7 +96,7 @@ Resource::Resource(KyraEngine *vm) { Common::for_each(_pakfiles.begin(), _pakfiles.end(), Common::bind2nd(Common::mem_fun(&ResourceFile::protect), true)); } else { for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { - Common::String filename = file->name(); + Common::String filename = file->getName(); filename.toUppercase(); // No real PAK file! @@ -104,8 +104,8 @@ Resource::Resource(KyraEngine *vm) { continue; if (filename.hasSuffix("PAK") || filename.hasSuffix("APK")) { - if (!loadPakFile(file->name())) - error("couldn't open pakfile '%s'", file->name().c_str()); + if (!loadPakFile(file->getName())) + error("couldn't open pakfile '%s'", file->getName().c_str()); } } diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index bbb186d0ae..c1e909ffdb 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -73,7 +73,7 @@ GameList Engine_QUEEN_detectGames(const FSList &fslist) { if (file->isDirectory()) { continue; } - if (file->name().equalsIgnoreCase("queen.1") || file->name().equalsIgnoreCase("queen.1c")) { + if (file->getName().equalsIgnoreCase("queen.1") || file->getName().equalsIgnoreCase("queen.1c")) { Common::File dataFile; if (!dataFile.open(*file)) { continue; diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index f60908d3ed..217b257e5e 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -205,7 +205,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com // the first match is used. static bool searchFSNode(const FSList &fslist, const Common::String &name, FilesystemNode &result) { for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { - if (!scumm_stricmp(file->name().c_str(), name.c_str())) { + if (!scumm_stricmp(file->getName().c_str(), name.c_str())) { result = *file; return true; } @@ -231,7 +231,7 @@ static Common::Language detectLanguage(const FSList &fslist, byte id) { FSList tmpList; if (searchFSNode(fslist, "RESOURCE", resDir) && resDir.isDirectory() - && resDir.listDir(tmpList, FilesystemNode::kListFilesOnly) + && resDir.getChildren(tmpList, FilesystemNode::kListFilesOnly) && searchFSNode(tmpList, filename, langFile)) { tmp.open(langFile); } @@ -328,7 +328,7 @@ static void detectGames(const FSList &fslist, Common::List<DetectorResult> &resu DetectorDesc d; d.node = *file; d.md5Entry = 0; - fileMD5Map[file->name()] = d; + fileMD5Map[file->getName()] = d; } } @@ -455,7 +455,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com Common::File tmp; if (!tmp.open(d.node)) { - warning("SCUMM detectGames: failed to open '%s' for read access", d.node.path().c_str()); + warning("SCUMM detectGames: failed to open '%s' for read access", d.node.getPath().c_str()); return false; } @@ -784,7 +784,7 @@ PluginError Engine_SCUMM_create(OSystem *syst, Engine **engine) { // Fetch the list of files in the current directory FSList fslist; FilesystemNode dir(ConfMan.get("path")); - if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) { return kInvalidPathError; } diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 84038990aa..d8e642d717 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -124,11 +124,11 @@ GameList Engine_SKY_detectGames(const FSList &fslist) { // Iterate over all files in the given directory for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { - const char *fileName = file->name().c_str(); + const char *fileName = file->getName().c_str(); if (0 == scumm_stricmp("sky.dsk", fileName)) { Common::File dataDisk; - if (dataDisk.open(file->path())) { + if (dataDisk.open(file->getPath())) { hasSkyDsk = true; dataDiskSize = dataDisk.size(); } @@ -136,7 +136,7 @@ GameList Engine_SKY_detectGames(const FSList &fslist) { if (0 == scumm_stricmp("sky.dnr", fileName)) { Common::File dinner; - if (dinner.open(file->path())) { + if (dinner.open(file->getPath())) { hasSkyDnr = true; dinnerTableEntries = dinner.readUint32LE(); } diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index 97e518421c..db978cd33e 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -107,15 +107,15 @@ GameDescriptor Engine_SWORD1_findGameID(const char *gameid) { void Sword1CheckDirectory(const FSList &fslist, bool *filesFound) { for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { - const char *fileName = file->name().c_str(); + const char *fileName = file->getName().c_str(); for (int cnt = 0; cnt < NUM_FILES_TO_CHECK; cnt++) if (scumm_stricmp(fileName, g_filesToCheck[cnt]) == 0) filesFound[cnt] = true; } else { for (int cnt = 0; cnt < ARRAYSIZE(g_dirNames); cnt++) - if (scumm_stricmp(file->name().c_str(), g_dirNames[cnt]) == 0) { + if (scumm_stricmp(file->getName().c_str(), g_dirNames[cnt]) == 0) { FSList fslist2; - if (file->listDir(fslist2, FilesystemNode::kListFilesOnly)) + if (file->getChildren(fslist2, FilesystemNode::kListFilesOnly)) Sword1CheckDirectory(fslist2, filesFound); } } diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 280beb7c22..be240e5956 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -101,7 +101,7 @@ GameList Engine_SWORD2_detectGames(const FSList &fslist) { // Iterate over all files in the given directory for (file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { - const char *fileName = file->name().c_str(); + const char *fileName = file->getName().c_str(); if (0 == scumm_stricmp(g->detectname, fileName)) { // Match found, add to list of candidates, then abort inner loop. @@ -118,11 +118,11 @@ GameList Engine_SWORD2_detectGames(const FSList &fslist) { // present e.g. if the user copied the data straight from CD. for (file = fslist.begin(); file != fslist.end(); ++file) { if (file->isDirectory()) { - const char *fileName = file->name().c_str(); + const char *fileName = file->getName().c_str(); if (0 == scumm_stricmp("clusters", fileName)) { FSList recList; - if (file->listDir(recList, FilesystemNode::kListAll)) { + if (file->getChildren(recList, FilesystemNode::kListAll)) { GameList recGames(Engine_SWORD2_detectGames(recList)); if (!recGames.empty()) { detectedGames.push_back(recGames); @@ -144,7 +144,7 @@ PluginError Engine_SWORD2_create(OSystem *syst, Engine **engine) { FSList fslist; FilesystemNode dir(ConfMan.get("path")); - if (!dir.listDir(fslist, FilesystemNode::kListAll)) { + if (!dir.getChildren(fslist, FilesystemNode::kListAll)) { return kInvalidPathError; } diff --git a/gui/browser.cpp b/gui/browser.cpp index b9cae7d923..ebe4aef0c4 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -222,15 +222,15 @@ void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data void BrowserDialog::updateListing() { // Update the path display - _currentPath->setLabel(_node.path()); + _currentPath->setLabel(_node.getPath()); // We memorize the last visited path. - ConfMan.set("browser_lastpath", _node.path()); + ConfMan.set("browser_lastpath", _node.getPath()); // Read in the data from the file system FilesystemNode::ListMode listMode = _isDirBrowser ? FilesystemNode::kListDirectoriesOnly : FilesystemNode::kListAll; - if (!_node.listDir(_nodeContent, listMode)) { + if (!_node.getChildren(_nodeContent, listMode)) { _nodeContent.clear(); } else { Common::sort(_nodeContent.begin(), _nodeContent.end()); @@ -240,9 +240,9 @@ void BrowserDialog::updateListing() { Common::StringList list; for (FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { if (!_isDirBrowser && i->isDirectory()) - list.push_back(i->displayName() + "/"); + list.push_back(i->getDisplayName() + "/"); else - list.push_back(i->displayName()); + list.push_back(i->getDisplayName()); } _fileList->setList(list); _fileList->scrollTo(0); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index eba5498318..4a92de1101 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -405,9 +405,9 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat if (browser.runModal() > 0) { // User made this choice... FilesystemNode file(browser.getResult()); - _soundFont->setLabel(file.path()); + _soundFont->setLabel(file.getPath()); - if (!file.path().empty() && (file.path() != "None")) + if (!file.getPath().empty() && (file.getPath() != "None")) _soundFontClearButton->setEnabled(true); else _soundFontClearButton->setEnabled(false); @@ -428,7 +428,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat // done with optional specific gameid to pluginmgr detectgames? // FSList files = dir.listDir(FilesystemNode::kListFilesOnly); - _gamePathWidget->setLabel(dir.path()); + _gamePathWidget->setLabel(dir.getPath()); draw(); } draw(); @@ -441,7 +441,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat if (browser.runModal() > 0) { // User made his choice... FilesystemNode dir(browser.getResult()); - _extraPathWidget->setLabel(dir.path()); + _extraPathWidget->setLabel(dir.getPath()); draw(); } draw(); @@ -453,7 +453,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat if (browser.runModal() > 0) { // User made his choice... FilesystemNode dir(browser.getResult()); - _savePathWidget->setLabel(dir.path()); + _savePathWidget->setLabel(dir.getPath()); draw(); } draw(); @@ -654,9 +654,9 @@ void LauncherDialog::addGame() { // User made his choice... FilesystemNode dir(_browser->getResult()); FSList files; - if (!dir.listDir(files, FilesystemNode::kListAll)) { + if (!dir.getChildren(files, FilesystemNode::kListAll)) { error("browser returned a node that is not a directory: '%s'", - dir.path().c_str()); + dir.getPath().c_str()); } // ...so let's determine a list of candidates, games that @@ -686,7 +686,7 @@ void LauncherDialog::addGame() { GameDescriptor result = candidates[idx]; // TODO: Change the detectors to set "path" ! - result["path"] = dir.path(); + result["path"] = dir.getPath(); Common::String domain = addGameToConf(result); diff --git a/gui/massadd.cpp b/gui/massadd.cpp index de54cada26..c12e60ea8b 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -127,9 +127,9 @@ void MassAddDialog::handleTickle() { FilesystemNode dir = _scanStack.pop(); FSList files; - if (!dir.listDir(files, FilesystemNode::kListAll)) { + if (!dir.getChildren(files, FilesystemNode::kListAll)) { error("browser returned a node that is not a directory: '%s'", - dir.path().c_str()); + dir.getPath().c_str()); } // Run the detector on the dir @@ -141,7 +141,7 @@ void MassAddDialog::handleTickle() { // e.g. ask the user which one to pick (make sure to display the // path, too). GameDescriptor result = candidates[0]; - result["path"] = dir.path(); + result["path"] = dir.getPath(); _games.push_back(result); } diff --git a/gui/options.cpp b/gui/options.cpp index 76a40f5f50..4d6cadfdef 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -821,7 +821,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 if (browser.runModal() > 0) { // User made his choice... FilesystemNode dir(browser.getResult()); - _savePath->setLabel(dir.path()); + _savePath->setLabel(dir.getPath()); draw(); // TODO - we should check if the directory is writeable before accepting it } @@ -832,7 +832,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 if (browser.runModal() > 0) { // User made his choice... FilesystemNode dir(browser.getResult()); - _themePath->setLabel(dir.path()); + _themePath->setLabel(dir.getPath()); draw(); } break; @@ -842,7 +842,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 if (browser.runModal() > 0) { // User made his choice... FilesystemNode dir(browser.getResult()); - _extraPath->setLabel(dir.path()); + _extraPath->setLabel(dir.getPath()); draw(); } break; @@ -852,9 +852,9 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 if (browser.runModal() > 0) { // User made his choice... FilesystemNode file(browser.getResult()); - _soundFont->setLabel(file.path()); + _soundFont->setLabel(file.getPath()); - if (!file.path().empty() && (file.path() != "None")) + if (!file.getPath().empty() && (file.getPath() != "None")) _soundFontClearButton->setEnabled(true); else _soundFontClearButton->setEnabled(false); diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp index 8f72127a75..4d8c439872 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -148,12 +148,12 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir, int level) { return; FSList fslist; - if (!node.listDir(fslist, FilesystemNode::kListAll)) + if (!node.getChildren(fslist, FilesystemNode::kListAll)) return; for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { if (i->isDirectory()) { - addDir(list, i->path(), level-1); + addDir(list, i->getPath(), level-1); } else { Entry th; if (isTheme(*i, th)) { @@ -176,7 +176,7 @@ bool ThemeBrowser::isTheme(const FilesystemNode &node, Entry &out) { Common::ConfigFile cfg; Common::String type; - out.file = node.name(); + out.file = node.getName(); for (int i = out.file.size()-1; out.file[i] != '.' && i > 0; --i) { out.file.deleteLastChar(); } |