Browse Source

Added error_code to boost::filesystem::current_path.

merge-requests/365/head
eidheim 10 years ago
parent
commit
f7345110cb
  1. 9
      src/dialogs.cc
  2. 5
      src/dialogs_win.cc

9
src/dialogs.cc

@ -3,6 +3,9 @@
#include "singletons.h"
#include <cmath>
#include <iostream>
using namespace std;
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
@ -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());

5
src/dialogs_win.cc

@ -99,8 +99,11 @@ private:
auto application=Glib::RefPtr<Application>::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;

Loading…
Cancel
Save