Catch Glib::ConvertError when checking for files
This fixes some edge-cases when scanning recent sessions in get_state_files_in_directory() and likely some other places that use run_functor_for_paths in case the folder contains files with non UTF-8 names.
This commit is contained in:
parent
2c4d1e011c
commit
473f575a05
|
@ -31,6 +31,7 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <glibmm/convert.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <glibmm/pattern.h>
|
||||
|
@ -130,9 +131,11 @@ run_functor_for_paths (vector<string>& result,
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Glib::FileError const& err)
|
||||
{
|
||||
warning << err.what() << endmsg;
|
||||
catch (Glib::FileError const& err) {
|
||||
warning << string_compose (_("Cannot access file: %1"), err.what()) << endmsg;
|
||||
}
|
||||
catch (Glib::ConvertError const& err) {
|
||||
warning << string_compose (_("Could not convert filename: %1"), err.what()) << endmsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue