From b762f2c670be71e45f1f4d3a9ccfb499201658c4 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 2 Feb 2013 22:51:14 +0000 Subject: Tidied directory creation --- src/profanity.c | 65 +++++++++------------------------------------------------ 1 file changed, 10 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/profanity.c b/src/profanity.c index 495d39a8..e53885c5 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -50,11 +50,6 @@ static void _handle_idle_time(void); static void _init(const int disable_tls, char *log_level); static void _shutdown(void); static void _create_directories(void); -static void _create_config_directory(void); -static void _create_data_directory(void); -static void _create_chatlog_directory(void); -static void _create_log_directory(void); -static void _create_themes_directory(void); static gboolean idle = FALSE; @@ -560,65 +555,25 @@ _shutdown(void) static void _create_directories(void) -{ - _create_config_directory(); - _create_data_directory(); - _create_chatlog_directory(); - _create_log_directory(); - _create_themes_directory(); -} - -static void -_create_config_directory(void) { gchar *xdg_config = xdg_get_config_home(); - GString *prof_conf_dir = g_string_new(xdg_config); - g_string_append(prof_conf_dir, "/profanity"); - mkdir_recursive(prof_conf_dir->str); - g_free(xdg_config); - g_string_free(prof_conf_dir, TRUE); -} - -static void -_create_data_directory(void) -{ gchar *xdg_data = xdg_get_data_home(); - GString *prof_data_dir = g_string_new(xdg_data); - g_string_append(prof_data_dir, "/profanity"); - mkdir_recursive(prof_data_dir->str); - g_free(xdg_data); - g_string_free(prof_data_dir, TRUE); -} -static void -_create_chatlog_directory(void) -{ - gchar *xdg_data = xdg_get_data_home(); + GString *themes_dir = g_string_new(xdg_config); + g_string_append(themes_dir, "/profanity/themes"); GString *chatlogs_dir = g_string_new(xdg_data); g_string_append(chatlogs_dir, "/profanity/chatlogs"); - mkdir_recursive(chatlogs_dir->str); - g_free(xdg_data); - g_string_free(chatlogs_dir, TRUE); -} + GString *logs_dir = g_string_new(xdg_data); + g_string_append(logs_dir, "/profanity/logs"); -static void -_create_log_directory(void) -{ - gchar *xdg_data = xdg_get_data_home(); - GString *chatlogs_dir = g_string_new(xdg_data); - g_string_append(chatlogs_dir, "/profanity/logs"); + mkdir_recursive(themes_dir->str); mkdir_recursive(chatlogs_dir->str); - g_free(xdg_data); + mkdir_recursive(logs_dir->str); + + g_string_free(themes_dir, TRUE); g_string_free(chatlogs_dir, TRUE); -} + g_string_free(logs_dir, TRUE); -static void -_create_themes_directory(void) -{ - gchar *xdg_config = xdg_get_config_home(); - GString *themes_dir = g_string_new(xdg_config); - g_string_append(themes_dir, "/profanity/themes"); - mkdir_recursive(themes_dir->str); g_free(xdg_config); - g_string_free(themes_dir, TRUE); + g_free(xdg_data); } -- cgit 1.4.1-2-gfad0