#include "intl.h"
#include "utils.h"
#include "socket.h"
+#include "../codeconv.h"
#define BUFFSIZE 8192
{
GList *result = NULL;
const gchar *p, *q;
- gchar *file;
+ gchar *escaped_utf8uri;
p = uri_list;
if (*p != '#') {
while (isspace(*p)) p++;
if (!strncmp(p, "file:", 5)) {
- p += 5;
q = p;
+ q += 5;
while (*q && *q != '\n' && *q != '\r') q++;
if (q > p) {
+ gchar *file, *locale_file = NULL;
q--;
while (q > p && isspace(*q)) q--;
- file = g_malloc(q - p + 2);
- strncpy(file, p, q - p + 1);
- file[q - p + 1] = '\0';
- result = g_list_append(result,file);
+ Xalloca(escaped_utf8uri, q - p + 2,
+ return result);
+ Xalloca(file, q - p + 2,
+ return result);
+ *file = '\0';
+ strncpy(escaped_utf8uri, p, q - p + 1);
+ escaped_utf8uri[q - p + 1] = '\0';
+ decode_uri(file, escaped_utf8uri);
+#warning FIXME_GTK2 /* should we use g_filename_from_utf8()? */
+ /*
+ * g_filename_from_uri() rejects escaped/locale encoded uri
+ * string which come from Nautilus.
+ */
+ if (g_utf8_validate(file, -1, NULL))
+ locale_file
+ = conv_codeset_strdup(
+ file + 5,
+ CS_UTF_8,
+ conv_get_current_charset_str());
+ if (!locale_file)
+ locale_file = g_strdup(file + 5);
+ result = g_list_append(result, locale_file);
}
}
}
* but as long as we are not able to do our own extensions to glibc, we do
* it here.
*/
-gchar *get_home_dir(void)
+const gchar *get_home_dir(void)
{
#if HAVE_DOSISH_SYSTEM
static gchar *home_dir;
#endif
}
-gchar *get_rc_dir(void)
+const gchar *get_rc_dir(void)
{
static gchar *rc_dir = NULL;
return rc_dir;
}
-gchar *get_news_cache_dir(void)
+const gchar *get_news_cache_dir(void)
{
static gchar *news_cache_dir = NULL;
return news_cache_dir;
}
-gchar *get_imap_cache_dir(void)
+const gchar *get_imap_cache_dir(void)
{
static gchar *imap_cache_dir = NULL;
return imap_cache_dir;
}
-gchar *get_mbox_cache_dir(void)
+const gchar *get_mbox_cache_dir(void)
{
static gchar *mbox_cache_dir = NULL;
return mbox_cache_dir;
}
-gchar *get_mime_tmp_dir(void)
+const gchar *get_mime_tmp_dir(void)
{
static gchar *mime_tmp_dir = NULL;
return mime_tmp_dir;
}
-gchar *get_template_dir(void)
+const gchar *get_template_dir(void)
{
static gchar *template_dir = NULL;
return template_dir;
}
-gchar *get_header_cache_dir(void)
+const gchar *get_header_cache_dir(void)
{
static gchar *header_dir = NULL;
return header_dir;
}
-gchar *get_tmp_dir(void)
+const gchar *get_tmp_dir(void)
{
static gchar *tmp_dir = NULL;
return tmp_file;
}
-gchar *get_domain_name(void)
+const gchar *get_domain_name(void)
{
static gchar *domain_name = NULL;