diff options
author | jstebbins <[email protected]> | 2008-06-30 23:53:04 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-06-30 23:53:04 +0000 |
commit | 1b44faba8af642f4892958b464309a94e52c8760 (patch) | |
tree | 1050b65785fd2d94a792ddd9a1f3e111d3e0aed9 /gtk/src/hb-backend.c | |
parent | 19c8a9d6099bfadbc72bfd9d5c09814597ac3ffe (diff) |
LinGui: clean up temporary file turds upon exit
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1546 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r-- | gtk/src/hb-backend.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 01f841999..c5c9b6285 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -27,6 +27,7 @@ #include "hb.h" #include "hbversion.h" #include <gtk/gtk.h> +#include <glib/gstdio.h> #include "hb-backend.h" #include "settings.h" #include "callbacks.h" @@ -407,6 +408,31 @@ static const iso639_lang_t language_table[] = }; #define LANG_TABLE_SIZE (sizeof(language_table)/ sizeof(iso639_lang_t)) +static void +del_tree(const gchar *name) +{ + const gchar *file; + + if (g_file_test(name, G_FILE_TEST_IS_DIR)) + { + GDir *gdir = g_dir_open(name, 0, NULL); + file = g_dir_read_name(gdir); + while (file) + { + gchar *path; + path = g_strdup_printf("%s/%s", name, file); + del_tree(path); + g_free(path); + file = g_dir_read_name(gdir); + } + g_rmdir(name); + } + else + { + g_unlink(name); + } +} + const gchar* ghb_version() { @@ -462,6 +488,17 @@ get_amix_value(gint val) // Handle for libhb. Gets set by ghb_backend_init() static hb_handle_t * h = NULL; +extern void hb_get_tempory_directory(hb_handle_t *h, char path[512]); + +void +ghb_hb_cleanup() +{ + char dir[512]; + + hb_get_tempory_directory(h, dir); + del_tree(dir); +} + static hb_audio_config_t* get_hb_audio(gint titleindex, gint track) { |