Browse Source

Fixed some issues with directories.

merge-requests/365/head
eidheim 10 years ago
parent
commit
a67230499f
  1. 32
      src/directories.cc

32
src/directories.cc

@ -74,14 +74,19 @@ Directories::Directories() {
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); std::this_thread::sleep_for(std::chrono::milliseconds(1000));
update_mutex.lock(); update_mutex.lock();
if(update_paths.size()==0) { if(update_paths.size()==0) {
for(auto &last_write_time: last_write_times) { for(auto it=last_write_times.begin();it!=last_write_times.end();) {
try { try {
if(last_write_time.second.second<boost::filesystem::last_write_time(last_write_time.first)) { if(boost::filesystem::exists(it->first)) { //Added for older boost versions (no exception thrown)
update_paths.emplace_back(last_write_time.first); if(it->second.second<boost::filesystem::last_write_time(it->first)) {
update_paths.emplace_back(it->first);
}
it++;
} }
else
it=last_write_times.erase(it);
} }
catch(const std::exception &e) { catch(const std::exception &e) {
last_write_times.erase(last_write_time.first); it=last_write_times.erase(it);
} }
} }
if(update_paths.size()>0) if(update_paths.size()>0)
@ -228,25 +233,12 @@ void Directories::add_path(const boost::filesystem::path& dir_path, const Gtk::T
} }
} }
if(*children) { if(*children) {
auto last_it=children->begin(); for(auto it=children->begin();it!=children->end();) {
auto it=last_it;
while(it!=children->end()) {
if(not_deleted.count(it->get_value(column_record.name))==0) { if(not_deleted.count(it->get_value(column_record.name))==0) {
if(it==children->begin()) { it=tree_store->erase(it);
tree_store->erase(it);
it=children->begin();
last_it=it;
}
else {
tree_store->erase(it);
it=last_it;
it++;
}
} }
else { else
last_it=it;
it++; it++;
}
} }
} }
if(!*children) { if(!*children) {

Loading…
Cancel
Save