Fixed handling of '.' character (indicating current directory) in

filesystem handling.  It is no longer a special case, since the FSNode
class now knows how to parse it directly.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2540 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-06-14 21:26:38 +00:00
parent 7fa87e9098
commit 9a4323eece
4 changed files with 4 additions and 30 deletions

View File

@ -38,12 +38,7 @@ FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode::FilesystemNode(const string& p)
{
AbstractFilesystemNode* tmp = 0;
if (p.empty() || p == "." || p == "~")
tmp = AbstractFilesystemNode::makeHomeDirectoryFileNode();
else
tmp = AbstractFilesystemNode::makeFileNodePath(p);
AbstractFilesystemNode* tmp = AbstractFilesystemNode::makeFileNodePath(p);
_realNode = Common::SharedPtr<AbstractFilesystemNode>(tmp);
}
@ -78,9 +73,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode, bool hidden) con
return false;
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i)
{
fslist.push_back(FilesystemNode(*i));
}
return true;
}

View File

@ -116,7 +116,7 @@ class FilesystemNode
* Create a new FilesystemNode referring to the specified path. This is
* the counterpart to the path() method.
*
* If path is empty or equals "." or "~", then a node representing the
* If path is empty or equals '~', then a node representing the
* "home directory" will be created. If that is not possible (since e.g. the
* operating system doesn't support the concept), some other directory is
* used (usually the root directory).
@ -374,15 +374,6 @@ class AbstractFilesystemNode
*/
virtual AbstractFilesystemNode* getParent() const = 0;
/**
* Returns a node representing the "home directory".
*
* On Unix, this will be the value of $HOME.
* On Windows, it will be the 'My Documents' folder.
* Otherwise, it should just return the same value as getRoot().
*/
static AbstractFilesystemNode* makeHomeDirectoryFileNode();
/**
* Construct a node based on a path; the path is in the same format as it
* would be for calls to fopen().
@ -395,6 +386,8 @@ class AbstractFilesystemNode
*/
static AbstractFilesystemNode* makeFileNodePath(const string& path);
// TODO - the following method isn't actually used anywhere in
// the current code (2012-06-14)
/**
* Returns a special node representing the filesystem root.
* The starting point for any file system browsing.

View File

@ -301,12 +301,6 @@ AbstractFilesystemNode* AbstractFilesystemNode::makeRootFileNode()
return new POSIXFilesystemNode();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFilesystemNode* AbstractFilesystemNode::makeHomeDirectoryFileNode()
{
return new POSIXFilesystemNode("~/", true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFilesystemNode* AbstractFilesystemNode::makeFileNodePath(const string& path)
{

View File

@ -376,12 +376,6 @@ AbstractFilesystemNode* AbstractFilesystemNode::makeRootFileNode()
return new WindowsFilesystemNode();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFilesystemNode* AbstractFilesystemNode::makeHomeDirectoryFileNode()
{
return new WindowsFilesystemNode("~\\");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFilesystemNode* AbstractFilesystemNode::makeFileNodePath(const string& path)
{