From da821cefbc41a90d1d13b387aa6b74548fec3744 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 16 Apr 2025 15:08:33 +0200 Subject: [PATCH] use propper current_path() --- src/chat_gui/file_selector.cpp | 6 ++++++ src/chat_gui/file_selector.hpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/chat_gui/file_selector.cpp b/src/chat_gui/file_selector.cpp index c7c6cfc..0f22302 100644 --- a/src/chat_gui/file_selector.cpp +++ b/src/chat_gui/file_selector.cpp @@ -15,6 +15,12 @@ void FileSelector::reset(void) { } FileSelector::FileSelector(void) { + try { + _current_file_path = std::filesystem::current_path(); + } catch (std::filesystem::filesystem_error const& ex) { + std::cerr << "FS: exception creating _current_file_path: " << ex.what() << "\n"; + } + reset(); } diff --git a/src/chat_gui/file_selector.hpp b/src/chat_gui/file_selector.hpp index 5f294ba..29bbb6e 100644 --- a/src/chat_gui/file_selector.hpp +++ b/src/chat_gui/file_selector.hpp @@ -6,7 +6,7 @@ #include struct FileSelector { - std::filesystem::path _current_file_path = std::filesystem::canonical(".") / ""; // add / + std::filesystem::path _current_file_path; struct CachedData { std::filesystem::path file_path; // can be used to check against current