From 369d329f4f6be4bee4dd9ab5c3d1498233578259 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 15 Apr 2009 23:46:22 +0200 Subject: Remove *.upgrade files in weechat dir after /upgrade --- src/core/wee-upgrade.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/core/wee-upgrade.c') 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 +#include #include #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); +} -- cgit v1.2.3