summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-10-08 12:00:57 +0000
committerJohn Smith <john.smith7545@yahoo.com>2012-10-08 12:00:57 +0000
commit900d1a05ba36f84df3a51188b938a6551a5201d2 (patch)
tree0ee71cf80c768ea871a6c32f7aa2b8bdb90e6b3c /src
parentFix for 303527 : GUI glitch on opacity box (diff)
downloadinkscape-900d1a05ba36f84df3a51188b938a6551a5201d2.tar.gz
inkscape-900d1a05ba36f84df3a51188b938a6551a5201d2.zip
Fix for 490338 : Try to create the autosave directory if that does not exists
(bzr r11759)
Diffstat (limited to 'src')
-rw-r--r--src/inkscape.cpp20
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp2
2 files changed, 19 insertions, 3 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index b1cc53b4e..0a94d0742 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -309,8 +309,24 @@ static gint inkscape_autosave(gpointer)
GDir *autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, NULL);
if( !autosave_dir_ptr ){
- g_warning("Cannot open autosave directory!");
- return TRUE;
+ // Try to create the autosave directory if it doesn't exist
+ if (g_mkdir(autosave_dir.c_str(), 0755)) {
+ // the creation failed
+ Glib::ustring msg = Glib::ustring::format(
+ _("Autosave failed! Cannot create directory "), Glib::filename_to_utf8(autosave_dir));
+ g_warning("%s", msg.c_str());
+ SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, msg.c_str());
+ return TRUE;
+ }
+ // Try to read dir again
+ autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, NULL);
+ if( !autosave_dir_ptr ){
+ Glib::ustring msg = Glib::ustring::format(
+ _("Autosave failed! Cannot open directory "), Glib::filename_to_utf8(autosave_dir));
+ g_warning("%s", msg.c_str());
+ SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, msg.c_str());
+ return TRUE;
+ }
}
time_t sptime = time(NULL);
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index ce73f47f1..2731b6174 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -1046,7 +1046,7 @@ void InkscapePreferences::initPageIO()
// Show the default fallback "tmp dir" if autosave path is not set.
_save_autosave_path.set_text(Glib::get_tmp_dir());
}
- _page_autosave.add_line(false, C_("Filesystem", "Autosave _directory:"), _save_autosave_path, "", _("The directory where autosaves will be written"), false);
+ _page_autosave.add_line(false, C_("Filesystem", "Autosave _directory:"), _save_autosave_path, "", _("The directory where autosaves will be written. This should be an absolute path (starts with / on UNIX or a drive letter such as C: on Windows). "), false);
_save_autosave_interval.init("/options/autosave/interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false);
_page_autosave.add_line(false, _("_Interval (in minutes):"), _save_autosave_interval, "", _("Interval (in minutes) at which document will be autosaved"), false);
_save_autosave_max.init("/options/autosave/max", 1.0, 100.0, 1.0, 10.0, 10.0, true, false);