Renamed methods in the FilesystemNode class to match the AbstractFSNode implementations.
Also exposed the new methods (exists, isReadable and isWritable) in FilesystemNode. svn-id: r27113
This commit is contained in:
parent
716bcd0b2b
commit
3b96c7fad5
24 changed files with 174 additions and 156 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
122
common/fs.cpp
122
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,22 +70,30 @@ FilesystemNode &FilesystemNode::operator= (const FilesystemNode &node) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool FilesystemNode::isValid() const {
|
||||
bool FilesystemNode::operator< (const FilesystemNode& node) const
|
||||
{
|
||||
if (isDirectory() && !node.isDirectory())
|
||||
return true;
|
||||
if (!isDirectory() && node.isDirectory())
|
||||
return false;
|
||||
return scumm_stricmp(getDisplayName().c_str(), node.getDisplayName().c_str()) < 0;
|
||||
}
|
||||
|
||||
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->isValid();
|
||||
}
|
||||
|
||||
FilesystemNode FilesystemNode::getParent() const {
|
||||
if (_realNode == 0)
|
||||
return *this;
|
||||
|
||||
AbstractFilesystemNode *node = _realNode->getParent();
|
||||
if (node == 0) {
|
||||
return *this;
|
||||
} else {
|
||||
return FilesystemNode(node);
|
||||
}
|
||||
return _realNode->exists();
|
||||
}
|
||||
|
||||
FilesystemNode FilesystemNode::getChild(const Common::String &n) const {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
Common::String FilesystemNode::getDisplayName() const {
|
||||
assert(_realNode);
|
||||
return _realNode->getDisplayName();
|
||||
}
|
||||
|
||||
Common::String FilesystemNode::getName() const {
|
||||
assert(_realNode);
|
||||
return _realNode->getName();
|
||||
}
|
||||
|
||||
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::isDirectory() const {
|
||||
if (_realNode == 0)
|
||||
return false;
|
||||
return _realNode->isDirectory();
|
||||
}
|
||||
|
||||
Common::String FilesystemNode::displayName() const {
|
||||
assert(_realNode);
|
||||
return _realNode->getDisplayName();
|
||||
}
|
||||
|
||||
Common::String FilesystemNode::name() const {
|
||||
assert(_realNode);
|
||||
return _realNode->getName();
|
||||
}
|
||||
|
||||
Common::String FilesystemNode::path() 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::isReadable() const {
|
||||
if (_realNode == 0)
|
||||
return false;
|
||||
return scumm_stricmp(displayName().c_str(), node.displayName().c_str()) < 0;
|
||||
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 _realNode->isWritable();
|
||||
}
|
||||
|
|
64
common/fs.h
64
common/fs.h
|
@ -119,42 +119,11 @@ public:
|
|||
*/
|
||||
bool operator< (const FilesystemNode& node) 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;
|
||||
|
||||
/**
|
||||
* Return a string representation of the name of the file. This is can be
|
||||
* used e.g. by detection code that relies on matching the name of a given
|
||||
* file. But it is *not* suitable for use with fopen / File::open, nor
|
||||
* should it be archived.
|
||||
*
|
||||
* @return the file name
|
||||
*/
|
||||
virtual Common::String name() const;
|
||||
|
||||
/**
|
||||
* Return a string representation of the file which can be passed to fopen(),
|
||||
* and is suitable for archiving (i.e. writing to the config file).
|
||||
* This will usually be a 'path' (hence the name of the method), but can
|
||||
* be anything that fulfills the above criterions.
|
||||
*
|
||||
* @note Do not assume that this string contains (back)slashes or any
|
||||
* other kind of 'path separators'.
|
||||
*
|
||||
* @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).
|
||||
|
@ -169,7 +138,38 @@ public:
|
|||
* @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 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 getDisplayName() const;
|
||||
|
||||
/**
|
||||
* Return a string representation of the name of the file. This is can be
|
||||
* used e.g. by detection code that relies on matching the name of a given
|
||||
* file. But it is *not* suitable for use with fopen / File::open, nor
|
||||
* should it be archived.
|
||||
*
|
||||
* @return the file name
|
||||
*/
|
||||
virtual Common::String getName() const;
|
||||
|
||||
/**
|
||||
* Return a string representation of the file which can be passed to fopen(),
|
||||
* and is suitable for archiving (i.e. writing to the config file).
|
||||
* This will usually be a 'path' (hence the name of the method), but can
|
||||
* be anything that fulfills the above criterions.
|
||||
*
|
||||
* @note Do not assume that this string contains (back)slashes or any
|
||||
* other kind of 'path separators'.
|
||||
*
|
||||
* @return the 'path' represented by this filesystem node
|
||||
*/
|
||||
virtual Common::String getPath() const;
|
||||
|
||||
/**
|
||||
* Get the parent node of this node. If this node has no parent node,
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue