summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
Diffstat (limited to 'windows')
-rw-r--r--windows/findfile.c16
-rw-r--r--windows/findfile.h2
-rw-r--r--windows/gui.c1
3 files changed, 13 insertions, 6 deletions
diff --git a/windows/findfile.c b/windows/findfile.c
index f47e49d03..c3e613d3a 100644
--- a/windows/findfile.c
+++ b/windows/findfile.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
+#include "utils/url.h"
#include "utils/log.h"
#include "utils/utils.h"
@@ -37,12 +38,19 @@ static char *realpath(const char *path, char *resolved_path)
char *path_to_url(const char *path)
{
- char *r = malloc(strlen(path) + 7 + 1);
+ char *url = malloc(strlen(path) + FILE_SCHEME_PREFIX_LEN + 1);
+ char *sidx;
- strcpy(r, "file://");
- strcat(r, path);
+ strcpy(url, FILE_SCHEME_PREFIX);
+ strcat(url, path);
- return r;
+ sidx = strrchr(url, '\\');
+ while (sidx != NULL) {
+ *sidx = '/';
+ sidx = strrchr(url, '\\');
+ }
+
+ return url;
}
/**
diff --git a/windows/findfile.h b/windows/findfile.h
index f9b6746da..fcc2da94d 100644
--- a/windows/findfile.h
+++ b/windows/findfile.h
@@ -21,8 +21,6 @@
#define NETSURF_WINDOWS_RESPATH "C:"
-char *path_to_url(const char *path);
-
extern char *nsws_find_resource(char *buf, const char *filename,
const char *def);
diff --git a/windows/gui.c b/windows/gui.c
index c4fc442e9..ab36d92dd 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -44,6 +44,7 @@
#include "desktop/selection.h"
#include "desktop/textinput.h"
#include "render/html.h"
+#include "utils/url.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"