mirror of https://github.com/stella-emu/stella.git
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:
parent
7fa87e9098
commit
9a4323eece
|
@ -38,12 +38,7 @@ FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
FilesystemNode::FilesystemNode(const string& p)
|
FilesystemNode::FilesystemNode(const string& p)
|
||||||
{
|
{
|
||||||
AbstractFilesystemNode* tmp = 0;
|
AbstractFilesystemNode* tmp = AbstractFilesystemNode::makeFileNodePath(p);
|
||||||
if (p.empty() || p == "." || p == "~")
|
|
||||||
tmp = AbstractFilesystemNode::makeHomeDirectoryFileNode();
|
|
||||||
else
|
|
||||||
tmp = AbstractFilesystemNode::makeFileNodePath(p);
|
|
||||||
|
|
||||||
_realNode = Common::SharedPtr<AbstractFilesystemNode>(tmp);
|
_realNode = Common::SharedPtr<AbstractFilesystemNode>(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,9 +73,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode, bool hidden) con
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i)
|
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i)
|
||||||
{
|
|
||||||
fslist.push_back(FilesystemNode(*i));
|
fslist.push_back(FilesystemNode(*i));
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ class FilesystemNode
|
||||||
* Create a new FilesystemNode referring to the specified path. This is
|
* Create a new FilesystemNode referring to the specified path. This is
|
||||||
* the counterpart to the path() method.
|
* 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
|
* "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
|
* operating system doesn't support the concept), some other directory is
|
||||||
* used (usually the root directory).
|
* used (usually the root directory).
|
||||||
|
@ -374,15 +374,6 @@ class AbstractFilesystemNode
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode* getParent() const = 0;
|
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
|
* Construct a node based on a path; the path is in the same format as it
|
||||||
* would be for calls to fopen().
|
* would be for calls to fopen().
|
||||||
|
@ -395,6 +386,8 @@ class AbstractFilesystemNode
|
||||||
*/
|
*/
|
||||||
static AbstractFilesystemNode* makeFileNodePath(const string& path);
|
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.
|
* Returns a special node representing the filesystem root.
|
||||||
* The starting point for any file system browsing.
|
* The starting point for any file system browsing.
|
||||||
|
|
|
@ -301,12 +301,6 @@ AbstractFilesystemNode* AbstractFilesystemNode::makeRootFileNode()
|
||||||
return new POSIXFilesystemNode();
|
return new POSIXFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
AbstractFilesystemNode* AbstractFilesystemNode::makeHomeDirectoryFileNode()
|
|
||||||
{
|
|
||||||
return new POSIXFilesystemNode("~/", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
AbstractFilesystemNode* AbstractFilesystemNode::makeFileNodePath(const string& path)
|
AbstractFilesystemNode* AbstractFilesystemNode::makeFileNodePath(const string& path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -376,12 +376,6 @@ AbstractFilesystemNode* AbstractFilesystemNode::makeRootFileNode()
|
||||||
return new WindowsFilesystemNode();
|
return new WindowsFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
AbstractFilesystemNode* AbstractFilesystemNode::makeHomeDirectoryFileNode()
|
|
||||||
{
|
|
||||||
return new WindowsFilesystemNode("~\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
AbstractFilesystemNode* AbstractFilesystemNode::makeFileNodePath(const string& path)
|
AbstractFilesystemNode* AbstractFilesystemNode::makeFileNodePath(const string& path)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue