diff options
author | James Booth <boothj5@gmail.com> | 2014-10-26 20:43:05 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-10-26 20:43:05 +0000 |
commit | be7c4f5a0051b61252001c5ae6cf46eed63b3bc0 (patch) | |
tree | 833f7c6e1ce7b6b3e18ae01f03b96b1fd904e356 /src/config | |
parent | 7a88898a21305573accf6fdd80ec6df20ce03026 (diff) | |
download | profani-tty-be7c4f5a0051b61252001c5ae6cf46eed63b3bc0.tar.gz |
Follow symlinks for profrc and accounts files
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/accounts.c | 9 | ||||
-rw-r--r-- | src/config/preferences.c | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c index 0bea55b4..b5e27127 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -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 * diff --git a/src/config/preferences.c b/src/config/preferences.c index 63c226f6..9f084951 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -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 * |