summaryrefslogtreecommitdiff
path: root/src/core/wee-upgrade.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-04-15 23:46:22 +0200
committerSebastien Helleu <flashcode@flashtux.org>2009-04-15 23:46:22 +0200
commit369d329f4f6be4bee4dd9ab5c3d1498233578259 (patch)
tree009dd8e1f2461f1946dfaa0b71e793107ed43613 /src/core/wee-upgrade.c
parent46dee68d5777f3c84069f5693c426288a7b39f80 (diff)
downloadweechat-369d329f4f6be4bee4dd9ab5c3d1498233578259.zip
Remove *.upgrade files in weechat dir after /upgrade
Diffstat (limited to 'src/core/wee-upgrade.c')
-rw-r--r--src/core/wee-upgrade.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c
index a99351e1a..849aa927e 100644
--- a/src/core/wee-upgrade.c
+++ b/src/core/wee-upgrade.c
@@ -24,12 +24,14 @@
#endif
#include <stdlib.h>
+#include <unistd.h>
#include <string.h>
#include "weechat.h"
#include "wee-upgrade.h"
#include "wee-infolist.h"
#include "wee-string.h"
+#include "wee-util.h"
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-history.h"
@@ -562,3 +564,33 @@ upgrade_weechat_load ()
return rc;
}
+
+/*
+ * upgrade_weechat_remove_file_cb: callback called to remove a .upgrade file
+ */
+
+void
+upgrade_weechat_remove_file_cb (void *data, const char *filename)
+{
+ /* make C compiler happy */
+ (void) data;
+
+ if (string_match (filename, "*.upgrade", 1))
+ {
+ if (weechat_debug_core >= 2)
+ gui_chat_printf (NULL, _("debug: removing file: %s"), filename);
+ unlink (filename);
+ }
+}
+
+/*
+ * upgrade_weechat_remove_files: remove *.upgrade files after upgrade
+ */
+
+void
+upgrade_weechat_remove_files ()
+{
+ util_exec_on_files (weechat_home,
+ NULL,
+ &upgrade_weechat_remove_file_cb);
+}