mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-27 14:29:42 +03:00
gui_find_resource --> gui_get_resource_url.
svn path=/trunk/netsurf/; revision=12089
This commit is contained in:
parent
66f6e9eff5
commit
a70c32422a
@ -431,7 +431,7 @@ void ami_amiupdate(void)
|
||||
/* end Amiupdate */
|
||||
}
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
char path[1024];
|
||||
char filename2[1024];
|
||||
|
@ -1049,7 +1049,7 @@ static inline void create_cursor(int flags, short mode, void * form, MFORM_EX *
|
||||
}
|
||||
}
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ static int32 bapp_thread(void *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
BString u("rsrc:/");
|
||||
u << filename;
|
||||
|
@ -50,7 +50,7 @@ NSString * const kAlwaysCloseMultipleTabs = @"AlwaysCloseMultipleTabs";
|
||||
|
||||
#define UNIMPL() NSLog( @"Function '%s' unimplemented", __func__ )
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
NSString *path = [[NSBundle mainBundle] pathForResource: [NSString stringWithUTF8String: filename] ofType: @""];
|
||||
if (path == nil) return NULL;
|
||||
|
@ -177,7 +177,7 @@ fetch_resource_setup(struct fetch *fetchh,
|
||||
|
||||
url_get_components(url, &urlcomp);
|
||||
|
||||
ctx->redirect_url = gui_find_resource(urlcomp.path);
|
||||
ctx->redirect_url = gui_get_resource_url(urlcomp.path);
|
||||
if (ctx->redirect_url == NULL) {
|
||||
ctx->handler = fetch_resource_notfound_handler;
|
||||
} else {
|
||||
|
@ -48,6 +48,6 @@ void fetch_resource_register(void);
|
||||
* \return A string containing the full URL of the target object or
|
||||
* NULL if no suitable resource can be found.
|
||||
*/
|
||||
char* gui_find_resource(const char *filename);
|
||||
char* gui_get_resource_url(const char *filename);
|
||||
|
||||
#endif
|
||||
|
@ -92,7 +92,7 @@ char *url_to_path(const char *url)
|
||||
return respath;
|
||||
}
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
return path_to_url(filepath_sfind(respaths, buf, filename));
|
||||
|
@ -326,7 +326,7 @@ static void check_options(char **respath)
|
||||
|
||||
}
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
return path_to_url(filepath_sfind(respaths, buf, filename));
|
||||
|
@ -72,7 +72,7 @@ void gui_quit(void)
|
||||
gtk_fetch_filetype_fin();
|
||||
}
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
return path_to_url(filepath_sfind(respaths, buf, filename));
|
||||
|
16
riscos/gui.c
16
riscos/gui.c
@ -281,24 +281,26 @@ static void ro_msg_save_desktop(wimp_message *message);
|
||||
static void ro_msg_window_info(wimp_message *message);
|
||||
static void ro_gui_view_source_bounce(wimp_message *message);
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
/* Find max URL length */
|
||||
size_t length = SLEN("file:///NetSurf:/Resources/") + SLEN("xx/") +
|
||||
strlen(filename) + 1;
|
||||
const char base_url[] = "file:///NetSurf:/Resources/";
|
||||
size_t filename_len = strlen(filename);
|
||||
|
||||
/* Allocate memory for URL (freed by the core) */
|
||||
/* Find max URL length */
|
||||
size_t length = SLEN(base_url) + SLEN("xx/") + filename_len + 1;
|
||||
|
||||
/* Allocate memory for URL (will be owned and 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/");
|
||||
resource_url = strcpy(resource_url, base_url);
|
||||
|
||||
/* 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) {
|
||||
if (strncmp(filename + filename_len - 5, ".html", 5) == 0) {
|
||||
resource_url = strcat(resource_url, "en/");
|
||||
}
|
||||
|
||||
|
@ -2542,7 +2542,7 @@ void gui_quit(void)
|
||||
LOG(("gui_quit"));
|
||||
}
|
||||
|
||||
char* gui_find_resource(const char *filename)
|
||||
char* gui_get_resource_url(const char *filename)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user