diff --git a/src/directories.cpp b/src/directories.cpp index fd6b19e..6bbc615 100644 --- a/src/directories.cpp +++ b/src/directories.cpp @@ -538,6 +538,9 @@ void Directories::open(const boost::filesystem::path &dir_path) { directories.clear(); add_or_update_path(path, Gtk::TreeModel::Row(), true); + + if(auto view = Notebook::get().get_current_view()) + view->update_status_file_path(view); } void Directories::close(const boost::filesystem::path &dir_path) { @@ -550,6 +553,9 @@ void Directories::close(const boost::filesystem::path &dir_path) { } else remove_path(dir_path); + + if(auto view = Notebook::get().get_current_view()) + view->update_status_file_path(view); } void Directories::update() { diff --git a/src/notebook.cpp b/src/notebook.cpp index 7787de1..05dc91a 100644 --- a/src/notebook.cpp +++ b/src/notebook.cpp @@ -1,6 +1,7 @@ #include "notebook.hpp" #include "config.hpp" #include "dialog.hpp" +#include "directories.hpp" #include "filesystem.hpp" #include "project.hpp" #include "selection_dialog.hpp" @@ -368,8 +369,12 @@ bool Notebook::open(const boost::filesystem::path &file_path_, Position position } }; view->update_status_file_path = [this](Source::BaseView *view) { - if(get_current_view() == view) - status_file_path.set_text(' ' + filesystem::get_short_path(view->file_path).string()); + if(get_current_view() == view) { + if(!Directories::get().path.empty() && filesystem::file_in_path(view->file_path, Directories::get().path)) + status_file_path.set_text(' ' + filesystem::get_relative_path(view->file_path, Directories::get().path).string()); + else + status_file_path.set_text(' ' + filesystem::get_short_path(view->file_path).string()); + } }; view->update_status_branch = [this](Source::BaseView *view) { if(get_current_view() == view) {