Fixed bug in FSNodeWindows::getParent() not always working correctly.

This commit is contained in:
Stephen Anthony 2017-09-09 13:57:42 -02:30
parent 02bae6346a
commit 73282db9fd
1 changed files with 4 additions and 10 deletions

View File

@ -298,22 +298,16 @@ bool FilesystemNodeWINDOWS::rename(const string& newfile)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNode* FilesystemNodeWINDOWS::getParent() const
{
if(!_isValid || _isPseudoRoot)
if(_isPseudoRoot)
return nullptr;
FilesystemNodeWINDOWS* p = new FilesystemNodeWINDOWS();
if(_path.size() > 3)
{
const char* start = _path.c_str();
const char* end = lastPathComponent(_path);
p->_path = string(start, end - start);
p->_isValid = true;
p->_isDirectory = true;
p->_isFile = false;
p->_displayName = lastPathComponent(p->_path);
p->_isPseudoRoot = false;
return new FilesystemNodeWINDOWS(string(start, size_t(end - start)));
}
return p;
else
return new FilesystemNodeWINDOWS();
}