--- a/libpurple/util.c Wed Sep 28 02:21:24 2016 +0300
+++ b/libpurple/util.c Wed Sep 28 14:15:08 2016 +0300
@@ -58,10 +58,10 @@
- mkdir_res = g_mkdir_with_parents(purple_xdg_dir, (S_IRUSR | S_IWUSR | S_IXUSR));
+ mkdir_res = purple_build_dir(purple_xdg_dir, (S_IRUSR | S_IWUSR | S_IXUSR)); purple_debug_error("util", "Error creating xdg directory %s: %s; failed migration\n",
- purple_xdg_dir, g_strerror(errno));
+ purple_xdg_dir, g_strerror(errno)); @@ -209,9 +209,7 @@
escape_js_gen = json_generator_new();
json_node_set_boolean(escape_js_node, FALSE);
- if (custom_user_dir == NULL) {
- migrate_to_xdg_base_dirs();
+ migrate_to_xdg_base_dirs(); @@ -3004,12 +3002,12 @@
- if (custom_user_dir != NULL) {
- return custom_user_dir;
- cache_dir = g_build_filename(g_get_user_cache_dir(), "purple", NULL);
+ if (!custom_user_dir) { + cache_dir = g_build_filename(g_get_user_cache_dir(), "purple", NULL); + cache_dir = g_build_filename(custom_user_dir, "cache", NULL); @@ -3018,12 +3016,12 @@
- if (custom_user_dir != NULL) {
- return custom_user_dir;
- config_dir = g_build_filename(g_get_user_config_dir(), "purple", NULL);
+ if (!custom_user_dir) { + config_dir = g_build_filename(g_get_user_config_dir(), "purple", NULL); + config_dir = g_build_filename(custom_user_dir, "config", NULL); @@ -3032,12 +3030,12 @@
- if (custom_user_dir != NULL) {
- return custom_user_dir;
- data_dir = g_build_filename(g_get_user_data_dir(), "purple", NULL);
+ if (!custom_user_dir) { + data_dir = g_build_filename(g_get_user_data_dir(), "purple", NULL); + data_dir = g_build_filename(custom_user_dir, "data", NULL); @@ -3053,7 +3051,7 @@
-int purple_build_dir (const char *path, int mode)
+int purple_build_dir(const char *path, int mode) return g_mkdir_with_parents(path, mode);
@@ -3069,7 +3067,7 @@
purple_debug_misc("util", "Writing file %s to directory %s",
- /* Ensure the user directory exists */
+ /* Ensure the directory exists */ if (!g_file_test(dir, G_FILE_TEST_IS_DIR))
if (g_mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
@@ -3088,11 +3086,6 @@
- * This function is long and beautiful, like my--um, yeah. Anyway,
- * it includes lots of error checking so as we don't overwrite
- * people's settings if there is a problem writing the new values.
purple_util_write_data_to_file(const char *filename, const char *data, gssize size)
@@ -3129,6 +3122,11 @@
+ * This function is long and beautiful, like my--um, yeah. Anyway, + * it includes lots of error checking so as we don't overwrite + * people's settings if there is a problem writing the new values. purple_util_write_data_to_file_absolute(const char *filename_full, const char *data, gssize size)
--- a/libpurple/util.h Wed Sep 28 02:21:24 2016 +0300
+++ b/libpurple/util.h Wed Sep 28 14:15:08 2016 +0300
@@ -791,9 +791,9 @@
* Returns the purple cache directory according to XDG Base Directory Specification.
- * This is usually ~/.cache/purple
- * See purple_home_dir()
+ * This is usually ~/.cache/purple. + * If custom user dir was specified then this is cache + * sub-directory of DIR argument passed to -c option. * Returns: The purple cache directory.
@@ -803,9 +803,9 @@
* Returns the purple configuration directory according to XDG Base Directory Specification.
- * This is usually ~/.config/purple
- * See purple_home_dir()
+ * This is usually ~/.config/purple. + * If custom user dir was specified then this is config + * sub-directory of DIR argument passed to -c option. * Returns: The purple configuration directory.
@@ -815,9 +815,9 @@
* Returns the purple data directory according to XDG Base Directory Specification.
- * This is usually ~/.local/share/purple
- * See purple_home_dir()
+ * This is usually ~/.local/share/purple. + * If custom user dir was specified then this is data + * sub-directory of DIR argument passed to -c option. * Returns: The purple data directory.
@@ -877,7 +877,8 @@
* Returns: TRUE if the file was written successfully. FALSE otherwise.
-gboolean purple_util_write_data_to_cache_file(const char *filename, const char *data, gssize size);
+purple_util_write_data_to_cache_file(const char *filename, const char *data, gssize size); * purple_util_write_data_to_config_file:
@@ -893,7 +894,8 @@
* Returns: TRUE if the file was written successfully. FALSE otherwise.
-gboolean purple_util_write_data_to_config_file(const char *filename, const char *data, gssize size);
+purple_util_write_data_to_config_file(const char *filename, const char *data, gssize size); * purple_util_write_data_to_data_file:
@@ -909,7 +911,8 @@
* Returns: TRUE if the file was written successfully. FALSE otherwise.
-gboolean purple_util_write_data_to_data_file(const char *filename, const char *data, gssize size);
+purple_util_write_data_to_data_file(const char *filename, const char *data, gssize size); * purple_util_write_data_to_file_absolute: