diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2012-08-26 15:20:34 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2012-10-20 11:34:18 +0200 |
commit | cbbde758b8ea533916fe25dc25d64bac564ea09a (patch) | |
tree | 48d74c0deed1885a5230ddcf897f4632bbbda257 /libsoup/soup-request-file.c | |
parent | aa8e1dc5127b56bd96e9d3068a6bfeb7c1a07a94 (diff) | |
download | libsoup-cbbde758b8ea533916fe25dc25d64bac564ea09a.tar.gz |
soup-request: Add support to handle gresource URI requests
GFile already supports gresource when using g_file_new_for_uri() with a
resource:// URI. We can add "resource" as a valid scheme for
SoupRequestFile and make sure the GFile is created with the gresource
URI for gresource requests.
https://bugzilla.gnome.org/show_bug.cgi?id=682721
Diffstat (limited to 'libsoup/soup-request-file.c')
-rw-r--r-- | libsoup/soup-request-file.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libsoup/soup-request-file.c b/libsoup/soup-request-file.c index 0b5638d2..73d0cd8c 100644 --- a/libsoup/soup-request-file.c +++ b/libsoup/soup-request-file.c @@ -128,7 +128,15 @@ soup_request_file_ensure_file (SoupRequestFile *file, windowsify_file_uri_path (decoded_path); #endif - file->priv->gfile = g_file_new_for_path (decoded_path); + if (uri->scheme == SOUP_URI_SCHEME_RESOURCE) { + char *uri_str; + + uri_str = g_strdup_printf ("resource://%s", decoded_path); + file->priv->gfile = g_file_new_for_uri (uri_str); + g_free (uri_str); + } else + file->priv->gfile = g_file_new_for_path (decoded_path); + g_free (decoded_path); return TRUE; } @@ -250,7 +258,7 @@ soup_request_file_get_content_type (SoupRequest *request) return file->priv->mime_type; } -static const char *file_schemes[] = { "file", NULL }; +static const char *file_schemes[] = { "file", "resource", NULL }; static void soup_request_file_class_init (SoupRequestFileClass *request_file_class) |