diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-08-21 16:15:32 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-08-21 16:15:32 +0000 |
| commit | d890608fa0adbafbb70f71df0f7fb076eaf35b44 (patch) | |
| tree | a499c111bfe6daf79ad0be911c4d03dadf72e06b /src/inkscape.cpp | |
| parent | use user-specific cache dir for clipboard temp file (diff) | |
| download | inkscape-d890608fa0adbafbb70f71df0f7fb076eaf35b44.tar.gz inkscape-d890608fa0adbafbb70f71df0f7fb076eaf35b44.zip | |
Enable autosaves by default, puts them in user cache dir
Diffstat (limited to 'src/inkscape.cpp')
| -rw-r--r-- | src/inkscape.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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 <cerrno> +#include <unistd.h> #include <map> @@ -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<SPDocument*,int>::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; |
