Some code rearrangement.

This commit is contained in:
Stephen Anthony 2022-07-03 17:25:41 -02:30
parent 513794a872
commit 3419b3f7fb
3 changed files with 15 additions and 15 deletions

View File

@ -125,6 +125,18 @@ bool FSNodeREGULAR::hasParent() const
return _path != "" && _path != ROOT_DIR;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNodePtr FSNodeREGULAR::getParent() const
{
if (_path == ROOT_DIR)
return nullptr;
const char* start = _path.c_str();
const char* end = lastPathComponent(_path);
cerr << " => path: " << _path << ", new: " << string(start, size_t(end - start)) << endl;
return make_unique<FSNodeREGULAR>(string(start, size_t(end - start)));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FSNodeREGULAR::getChildren(AbstractFSList& myList, ListMode mode) const
{
@ -278,15 +290,3 @@ bool FSNodeREGULAR::rename(const string& newfile)
}
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNodePtr FSNodeREGULAR::getParent() const
{
if (_path == ROOT_DIR)
return nullptr;
const char* start = _path.c_str();
const char* end = lastPathComponent(_path);
cerr << " => path: " << _path << ", new: " << string(start, size_t(end - start)) << endl;
return make_unique<FSNodeREGULAR>(string(start, size_t(end - start)));
}

View File

@ -49,7 +49,6 @@ class FSNodeREGULAR : public AbstractFSNode
void setName(const string& name) override { _displayName = name; }
const string& getPath() const override { return _path; }
string getShortPath() const override;
bool hasParent() const override;
bool isDirectory() const override { return _isDirectory; }
bool isFile() const override { return _isFile; }
bool isReadable() const override { return _isReadable; }
@ -63,8 +62,9 @@ class FSNodeREGULAR : public AbstractFSNode
size_t write(const ByteBuffer& buffer, size_t size) const override;
size_t write(const stringstream& buffer) const override;
bool getChildren(AbstractFSList& list, ListMode mode) const override;
bool hasParent() const override;
AbstractFSNodePtr getParent() const override;
bool getChildren(AbstractFSList& list, ListMode mode) const override;
protected:
fs::path _fspath;

View File

@ -991,7 +991,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
case EditableWidget::kChangedCmd:
case EditableWidget::kAcceptCmd:
{
bool subDirs = instance().settings().getBool("launchersubdirs");
const bool subDirs = instance().settings().getBool("launchersubdirs");
myList->setIncludeSubDirs(subDirs);
if(subDirs && cmd == EditableWidget::kChangedCmd)