diff --git a/src/dialogs.cc b/src/dialogs.cc index 8f66ab0..5e32036 100644 --- a/src/dialogs.cc +++ b/src/dialogs.cc @@ -3,6 +3,9 @@ #include "singletons.h" #include +#include +using namespace std; + namespace sigc { #ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE template @@ -42,9 +45,11 @@ std::string Dialog::gtk_dialog(const std::string &title, dialog.set_transient_for(*application->window); auto current_path=application->window->notebook.get_current_folder(); + boost::system::error_code ec; if(current_path.empty()) - current_path=boost::filesystem::current_path(); - gtk_file_chooser_set_current_folder((GtkFileChooser*)dialog.gobj(), current_path.string().c_str()); + current_path=boost::filesystem::current_path(ec); + if(!ec) + gtk_file_chooser_set_current_folder((GtkFileChooser*)dialog.gobj(), current_path.string().c_str()); if (!file_name.empty()) gtk_file_chooser_set_filename((GtkFileChooser*)dialog.gobj(), file_name.c_str()); diff --git a/src/dialogs_win.cc b/src/dialogs_win.cc index 377bf16..72d1869 100644 --- a/src/dialogs_win.cc +++ b/src/dialogs_win.cc @@ -99,8 +99,11 @@ private: auto application=Glib::RefPtr::cast_static(gio_application); auto current_path=application->window->notebook.get_current_folder(); + boost::system::error_code ec; if(current_path.empty()) - current_path=boost::filesystem::current_path(); + current_path=boost::filesystem::current_path(ec); + if(ec) + return false; std::wstring path=current_path.native(); size_t pos=0;