summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6d8aa71)
raw | patch | inline | side by side (parent: 6d8aa71)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Sun, 28 Jun 2009 21:40:37 +0000 (21:40 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Sun, 28 Jun 2009 21:40:37 +0000 (21:40 +0000) |
src/file.cpp | patch | blob | history |
diff --git a/src/file.cpp b/src/file.cpp
index 136d946b9b0bb6a2ec7c81e183f9d036bb31b75d..049c1acb405313bce8ad55075074075720e742cc 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
if (!doc)
return;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ if(import_path.empty())
+ {
+ Glib::ustring attr = prefs->getString("/dialogs/import/path");
+ if (!attr.empty()) import_path = attr;
+ }
+
+ //# Test if the import_path directory exists
+ if (!Inkscape::IO::file_test(import_path.c_str(),
+ (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+ import_path = "";
+
+ //# If no open path, default to our home directory
+ if (import_path.empty())
+ {
+ import_path = g_get_home_dir();
+ import_path.append(G_DIR_SEPARATOR_S);
+ }
+
// Create new dialog (don't use an old one, because parentWindow has probably changed)
Inkscape::UI::Dialog::FileOpenDialog *importDialogInstance =
Inkscape::UI::Dialog::FileOpenDialog::create(
else
g_warning( "ERROR CONVERTING OPEN FILENAME TO UTF-8" );
-
- import_path = fileName;
- if (import_path.size()>0)
- import_path.append(G_DIR_SEPARATOR_S);
+ import_path = Glib::path_get_dirname (fileName);
+ import_path.append(G_DIR_SEPARATOR_S);
+ prefs->setString("/dialogs/import/path", import_path);
file_import(doc, fileName, selection);
}