summaryrefslogtreecommitdiff
path: root/riscos/gui.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-03-15 23:23:27 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-03-15 23:23:27 +0000
commitffc8d17a0f4fabc26b45486dbf195015e9fcf76e (patch)
tree45008ec382af68cf48d0183ff711802142192c64 /riscos/gui.c
parent1da7b161f8eb8e2afbb46e9e2904dc3973fc2458 (diff)
downloadnetsurf-ffc8d17a0f4fabc26b45486dbf195015e9fcf76e.tar.gz
netsurf-ffc8d17a0f4fabc26b45486dbf195015e9fcf76e.tar.bz2
Simple language directory handling.
svn path=/trunk/netsurf/; revision=12069
Diffstat (limited to 'riscos/gui.c')
-rw-r--r--riscos/gui.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/riscos/gui.c b/riscos/gui.c
index cb3a9504a..6d197e3fe 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -283,15 +283,26 @@ static void ro_gui_view_source_bounce(wimp_message *message);
char* gui_find_resource(const char *filename)
{
- /* TODO: handle language directories */
- size_t length = strlen(filename) +
- SLEN("file:///NetSurf:/Resources/") + 1;
+ /* Find max URL length */
+ size_t length = SLEN("file:///NetSurf:/Resources/") + SLEN("xx/") +
+ strlen(filename) + 1;
+ /* Allocate memory for URL (freed by the core) */
char *resource_url = malloc(length);
if (resource_url == NULL)
return NULL;
+ /* Insert base URL */
resource_url = strcpy(resource_url, "file:///NetSurf:/Resources/");
+
+ /* Add language directory to URL, for translated files */
+ /* TODO: handle non-en langauages
+ * handle non-html translated files */
+ if (strncmp(filename + strlen(filename) - 5, ".html", 5) == 0) {
+ resource_url = strcat(resource_url, "en/");
+ }
+
+ /* Add filename to URL */
return strcat(resource_url, filename);
}