about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config/accounts.c1
-rw-r--r--src/config/preferences.c1
-rw-r--r--src/config/theme.c1
-rw-r--r--src/files.c101
-rw-r--r--src/files.h28
-rw-r--r--src/log.c1
-rw-r--r--src/profanity.c74
7 files changed, 72 insertions, 135 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c
index c494564d..b94f27c2 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -28,7 +28,6 @@
 #include "accounts.h"
 
 #include "common.h"
-#include "files.h"
 #include "jid.h"
 #include "log.h"
 #include "tools/autocomplete.h"
diff --git a/src/config/preferences.c b/src/config/preferences.c
index f942bb48..0a807a48 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -33,7 +33,6 @@
 #endif
 
 #include "common.h"
-#include "files.h"
 #include "log.h"
 #include "preferences.h"
 #include "tools/autocomplete.h"
diff --git a/src/config/theme.c b/src/config/theme.c
index 0f18d4c6..5ca19969 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -33,7 +33,6 @@
 #endif
 
 #include "common.h"
-#include "files.h"
 #include "log.h"
 #include "theme.h"
 
diff --git a/src/files.c b/src/files.c
deleted file mode 100644
index 8600e2ea..00000000
--- a/src/files.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * files.c
- *
- * Copyright (C) 2012, 2013 James Booth <boothj5@gmail.com>
- *
- * This file is part of Profanity.
- *
- * Profanity is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Profanity is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Profanity.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include <glib.h>
-
-#include "common.h"
-
-static void _files_create_config_directory(void);
-static void _files_create_data_directory(void);
-static void _files_create_chatlog_directory(void);
-static void _files_create_log_directory(void);
-static void _files_create_themes_directory(void);
-
-void
-files_create_directories(void)
-{
-    _files_create_config_directory();
-    _files_create_data_directory();
-    _files_create_chatlog_directory();
-    _files_create_log_directory();
-    _files_create_themes_directory();
-}
-
-static void
-_files_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
-_files_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
-_files_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
-_files_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
-_files_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);
-}
diff --git a/src/files.h b/src/files.h
deleted file mode 100644
index 5b88009d..00000000
--- a/src/files.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * files.h
- *
- * Copyright (C) 2012, 2013 James Booth <boothj5@gmail.com>
- *
- * This file is part of Profanity.
- *
- * Profanity is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Profanity is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Profanity.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef FILES_H
-#define FILES_H
-
-void files_create_directories(void);
-
-#endif
diff --git a/src/log.c b/src/log.c
index 38e5a494..86db07ae 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,7 +33,6 @@
 
 #include "common.h"
 #include "config/preferences.h"
-#include "files.h"
 
 #define PROF "prof"
 
diff --git a/src/profanity.c b/src/profanity.c
index f0a9372e..495d39a8 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -39,7 +39,6 @@
 #include "common.h"
 #include "contact.h"
 #include "contact_list.h"
-#include "files.h"
 #include "log.h"
 #include "muc.h"
 #include "ui/ui.h"
@@ -50,6 +49,12 @@ static gboolean _process_input(char *inp);
 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;
 
@@ -515,7 +520,7 @@ _init(const int disable_tls, char *log_level)
     setlocale(LC_ALL, "");
     // ignore SIGPIPE
     signal(SIGPIPE, SIG_IGN);
-    files_create_directories();
+    _create_directories();
     log_level_t prof_log_level = _get_log_level(log_level);
     log_init(prof_log_level);
     if (strcmp(PACKAGE_STATUS, "development") == 0) {
@@ -552,3 +557,68 @@ _shutdown(void)
     cmd_close();
     log_close();
 }
+
+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");
+    mkdir_recursive(themes_dir->str);
+    g_free(xdg_config);
+    g_string_free(themes_dir, TRUE);
+}