diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/FileManager.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp index d8a0612..ccaf2c1 100644 --- a/src/plugins/FileManager.cpp +++ b/src/plugins/FileManager.cpp @@ -41,6 +41,11 @@ namespace QuickMedia { return file_get_filetime_or(path1, std::filesystem::file_time_type::min()) > file_get_filetime_or(path2, std::filesystem::file_time_type::min()); }); + if(current_dir != "/") { + auto parent_item = BodyItem::create(".."); + result_items.push_back(std::move(parent_item)); + } + for(auto &p : paths) { auto body_item = BodyItem::create(p.path().filename().string()); // TODO: Check file magic number instead of extension? @@ -62,12 +67,21 @@ namespace QuickMedia { } bool FileManager::set_child_directory(const std::string &filename) { - std::filesystem::path new_path = current_dir / filename; - if(std::filesystem::is_directory(new_path)) { - current_dir = std::move(new_path); - return true; + if(filename == "..") { + std::filesystem::path new_path = current_dir.parent_path(); + if(std::filesystem::is_directory(new_path)) { + current_dir = std::move(new_path); + return true; + } + return false; + } else { + std::filesystem::path new_path = current_dir / filename; + if(std::filesystem::is_directory(new_path)) { + current_dir = std::move(new_path); + return true; + } + return false; } - return false; } const std::filesystem::path& FileManager::get_current_dir() const { |