From 3dfde2b2ca388030038a65d6dba71a8571378997 Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 7 Mar 2006 02:01:28 +0000 Subject: allow relative signature path. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1031 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/compose.c') diff --git a/src/compose.c b/src/compose.c index 844b8f53..c6dc645e 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1783,6 +1783,7 @@ static void compose_enable_sig(Compose *compose) static gchar *compose_get_signature_str(Compose *compose) { + gchar *sig_path; gchar *sig_body = NULL; gchar *sig_str = NULL; gchar *utf8_sig_str = NULL; @@ -1791,26 +1792,40 @@ static gchar *compose_get_signature_str(Compose *compose) if (!compose->account->sig_path) return NULL; + if (g_path_is_absolute(compose->account->sig_path) || + compose->account->sig_type == SIG_COMMAND) + sig_path = g_strdup(compose->account->sig_path); + else { +#ifdef G_OS_WIN32 + sig_path = g_strconcat(get_rc_dir(), +#else + sig_path = g_strconcat(get_home_dir(), +#endif + G_DIR_SEPARATOR_S, + compose->account->sig_path, NULL); + } if (compose->account->sig_type == SIG_FILE) { - if (!is_file_or_fifo_exist(compose->account->sig_path)) { + if (!is_file_or_fifo_exist(sig_path)) { debug_print("can't open signature file: %s\n", - compose->account->sig_path); + sig_path); + g_free(sig_path); return NULL; } } if (compose->account->sig_type == SIG_COMMAND) - sig_body = get_command_output(compose->account->sig_path); + sig_body = get_command_output(sig_path); else { gchar *tmp; - tmp = file_read_to_str(compose->account->sig_path); + tmp = file_read_to_str(sig_path); if (!tmp) return NULL; sig_body = normalize_newlines(tmp); g_free(tmp); } + g_free(sig_path); if (prefs_common.sig_sep) { sig_str = g_strconcat(prefs_common.sig_sep, "\n", sig_body, -- cgit v1.2.3