1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Tidied directory creation

This commit is contained in:
James Booth 2013-02-02 22:51:14 +00:00
parent 3d0e0d7ea4
commit b762f2c670

View File

@ -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 *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);
}
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(chatlogs_dir->str);
g_free(xdg_data);
g_string_free(chatlogs_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");
GString *chatlogs_dir = g_string_new(xdg_data);
g_string_append(chatlogs_dir, "/profanity/chatlogs");
GString *logs_dir = g_string_new(xdg_data);
g_string_append(logs_dir, "/profanity/logs");
mkdir_recursive(themes_dir->str);
g_free(xdg_config);
mkdir_recursive(chatlogs_dir->str);
mkdir_recursive(logs_dir->str);
g_string_free(themes_dir, TRUE);
g_string_free(chatlogs_dir, TRUE);
g_string_free(logs_dir, TRUE);
g_free(xdg_config);
g_free(xdg_data);
}