summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-01-07 14:29:36 +0100
committerportix <portix@gmx.net>2012-01-07 14:29:36 +0100
commit0fe56ec1d948ed6280973db39345aef3e7fe604f (patch)
tree536894ee1a98b6489bf30f868e4e2f937d679d0b
parentcd970cb9b5163fab1aa3977f6d0ca9cce3a6387f (diff)
downloaddwb-0fe56ec1d948ed6280973db39345aef3e7fe604f.zip
Only remove content of the cachdir when cleaning up, not the directory itself.
-rw-r--r--src/dwb.c2
-rw-r--r--src/util.c6
-rw-r--r--src/util.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/dwb.c b/src/dwb.c
index 63c61a01..1179d2f6 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -2353,7 +2353,7 @@ dwb_clean_up() {
if (g_file_test(dwb.files.fifo, G_FILE_TEST_EXISTS)) {
unlink(dwb.files.fifo);
}
- util_rmdir(dwb.files.cachedir, true);
+ util_rmdir(dwb.files.cachedir, true, true);
gtk_widget_destroy(dwb.gui.window);
return true;
}/*}}}*/
diff --git a/src/util.c b/src/util.c
index fbd4a0c7..575acd9b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -303,7 +303,7 @@ util_get_directory_content(GString **buffer, const char *dirname, const char *ex
}/*}}}*/
void
-util_rmdir(const char *path, gboolean recursive) {
+util_rmdir(const char *path, gboolean only_content, gboolean recursive) {
GDir *dir = g_dir_open(path, 0, NULL);
if (dir == NULL)
return;
@@ -315,12 +315,12 @@ util_rmdir(const char *path, gboolean recursive) {
unlink(fullpath);
}
else if (recursive) {
- util_rmdir(fullpath, true);
+ util_rmdir(fullpath, false, true);
rmdir(fullpath);
}
g_free(fullpath);
}
- if (filename == NULL) {
+ if (filename == NULL && !only_content) {
rmdir(path);
}
g_dir_close(dir);
diff --git a/src/util.h b/src/util.h
index 7feeed22..976b67e5 100644
--- a/src/util.h
+++ b/src/util.h
@@ -28,7 +28,7 @@ gboolean util_is_hex(const char *string);
int util_test_connect(const char *uri);
char * util_get_temp_filename(const char *);
-void util_rmdir(const char *path, gboolean recursive);
+void util_rmdir(const char *path, gboolean, gboolean recursive);
// keys
char * dwb_modmask_to_string(guint );