From d890608fa0adbafbb70f71df0f7fb076eaf35b44 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 21 Aug 2018 18:15:32 +0200 Subject: Enable autosaves by default, puts them in user cache dir --- src/inkscape.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 05b5aeec1..67bedb1f8 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -19,6 +19,7 @@ #endif #include +#include #include @@ -212,7 +213,7 @@ int Application::autosave() if (!tmp.empty()) { autosave_dir = tmp; } else { - autosave_dir = Glib::get_tmp_dir(); + autosave_dir = Glib::build_filename(Glib::get_user_cache_dir(), "inkscape"); } } @@ -239,6 +240,7 @@ int Application::autosave() gint autosave_max = prefs->getInt("/options/autosave/max", 10); gint docnum = 0; + int pid = ::getpid(); SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Autosaving documents...")); for (std::map::iterator iter = _document_set.begin(); @@ -251,6 +253,7 @@ int Application::autosave() Inkscape::XML::Node *repr = doc->getReprRoot(); + if (doc->isModifiedSinceSave()) { gchar *oldest_autosave = nullptr; const gchar *filename = nullptr; @@ -296,7 +299,7 @@ int Application::autosave() // Set the filename we will actually save to g_free(baseName); - baseName = g_strdup_printf("inkscape-autosave-%d-%s-%03d.svg", uid, sptstr, docnum); + baseName = g_strdup_printf("inkscape-autosave-%d-%d-%s-%03d.svg", uid, pid, sptstr, docnum); gchar* full_path = g_build_filename(autosave_dir.c_str(), baseName, NULL); g_free(baseName); baseName = nullptr; -- cgit v1.2.3