Commit 1fd4adcf authored by Ell's avatar Ell

buffer: clean swap files that match old filename pattern on startup

Commit b61f9015 changed the
filename pattern of swap files, and limited the cleaned-up files on
startup (or when changing the swap dir) to only those files that
match the new pattern.

Keep cleaning up files that match the old pattern too, at least for
now, especially since GIMP has been leaving old swap files behind
for a while.
parent d2302106
......@@ -38,7 +38,14 @@
#include "gegl-buffer-swap-private.h"
#define SWAP_PREFIX "gegl-swap-"
#define SWAP_PREFIX "gegl-swap-"
/* this used to be the suffix for swap files before commit
* b61f9015bf19611225df9832db3cfd9ee2558fc9. let's keep
* cleaning files that match this suffix on startup, at least
* for a while.
*/
#define SWAP_LEGACY_SUFFIX "-shared.swap"
/* local function prototypes */
......@@ -238,18 +245,20 @@ gegl_buffer_swap_clean_dir (void)
while ((basename = g_dir_read_name (dir)) != NULL)
{
gint pid = 0;
if (g_str_has_prefix (basename, SWAP_PREFIX))
{
gint pid = atoi (basename + strlen (SWAP_PREFIX));
pid = atoi (basename + strlen (SWAP_PREFIX));
else if (g_str_has_suffix (basename, SWAP_LEGACY_SUFFIX))
pid = atoi (basename);
if (! gegl_buffer_swap_pid_is_running (pid))
{
gchar *path = g_build_filename (swap_dir, basename, NULL);
if (pid && ! gegl_buffer_swap_pid_is_running (pid))
{
gchar *path = g_build_filename (swap_dir, basename, NULL);
g_unlink (path);
g_unlink (path);
g_free (path);
}
g_free (path);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment