diff --git a/src/directories.cc b/src/directories.cc index 373e3b0..c73c004 100644 --- a/src/directories.cc +++ b/src/directories.cc @@ -185,11 +185,11 @@ Directories::Directories() : Gtk::TreeView(), stop_update_thread(false) { if(!ec) { if(last_write_time!=now && it->second.second(it->first); - dispatcher.post([this, path] { + dispatcher.post([this, path, last_write_time] { update_mutex.lock(); auto it=last_write_times.find(*path); if(it!=last_write_times.end()) - add_path(*path, it->second.first); + add_path(*path, it->second.first, last_write_time); update_mutex.unlock(); }); } @@ -403,9 +403,10 @@ bool Directories::on_button_press_event(GdkEventButton* event) { return Gtk::TreeView::on_button_press_event(event); } -void Directories::add_path(const boost::filesystem::path &dir_path, const Gtk::TreeModel::Row &parent) { +void Directories::add_path(const boost::filesystem::path &dir_path, const Gtk::TreeModel::Row &parent, time_t last_write_time) { boost::system::error_code ec; - auto last_write_time=boost::filesystem::last_write_time(dir_path, ec); + if(last_write_time==0) + last_write_time=boost::filesystem::last_write_time(dir_path, ec); if(ec) return; last_write_times[dir_path.string()]={parent, last_write_time}; diff --git a/src/directories.h b/src/directories.h index f0b9202..61daccc 100644 --- a/src/directories.h +++ b/src/directories.h @@ -58,7 +58,7 @@ protected: bool on_button_press_event(GdkEventButton *event) override; private: - void add_path(const boost::filesystem::path &dir_path, const Gtk::TreeModel::Row &row); + void add_path(const boost::filesystem::path &dir_path, const Gtk::TreeModel::Row &row, time_t last_write_time=0); Glib::RefPtr tree_store; TreeStore::ColumnRecord column_record;