From 73282db9fdb66133d2f381f92058982718a25307 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 9 Sep 2017 13:57:42 -0230 Subject: [PATCH] Fixed bug in FSNodeWindows::getParent() not always working correctly. --- src/windows/FSNodeWINDOWS.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/windows/FSNodeWINDOWS.cxx b/src/windows/FSNodeWINDOWS.cxx index 5405d4566..dfd3e1d2a 100644 --- a/src/windows/FSNodeWINDOWS.cxx +++ b/src/windows/FSNodeWINDOWS.cxx @@ -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(); }