Follow symlinks for profrc and accounts files

This commit is contained in:
James Booth
2014-10-26 20:43:05 +00:00
parent 7a88898a21
commit be7c4f5a00
4 changed files with 43 additions and 2 deletions

View File

@@ -808,9 +808,16 @@ _save_accounts(void)
{
gsize g_data_size;
gchar *g_accounts_data = g_key_file_to_data(accounts, &g_data_size, NULL);
g_file_set_contents(accounts_loc, g_accounts_data, g_data_size, NULL);
gchar *xdg_data = xdg_get_data_home();
GString *base_str = g_string_new(xdg_data);
g_string_append(base_str, "/profanity/");
gchar *true_loc = get_file_or_linked(accounts_loc, base_str->str);
g_file_set_contents(true_loc, g_accounts_data, g_data_size, NULL);
g_chmod(accounts_loc, S_IRUSR | S_IWUSR);
g_free(xdg_data);
free(true_loc);
g_free(g_accounts_data);
g_string_free(base_str, TRUE);
}
static gchar *

View File

@@ -406,9 +406,16 @@ _save_prefs(void)
{
gsize g_data_size;
gchar *g_prefs_data = g_key_file_to_data(prefs, &g_data_size, NULL);
g_file_set_contents(prefs_loc, g_prefs_data, g_data_size, NULL);
gchar *xdg_config = xdg_get_config_home();
GString *base_str = g_string_new(xdg_config);
g_string_append(base_str, "/profanity/");
gchar *true_loc = get_file_or_linked(prefs_loc, base_str->str);
g_file_set_contents(true_loc, g_prefs_data, g_data_size, NULL);
g_chmod(prefs_loc, S_IRUSR | S_IWUSR);
g_free(xdg_config);
free(true_loc);
g_free(g_prefs_data);
g_string_free(base_str, TRUE);
}
static gchar *