summaryrefslogtreecommitdiff
path: root/fitz/stm_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/stm_open.c')
-rw-r--r--fitz/stm_open.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fitz/stm_open.c b/fitz/stm_open.c
index 1e303825..ced32d80 100644
--- a/fitz/stm_open.c
+++ b/fitz/stm_open.c
@@ -129,7 +129,21 @@ fz_open_fd(fz_context *ctx, int fd)
fz_stream *
fz_open_file(fz_context *ctx, const char *name)
{
+#ifdef _WIN32
+ char *s = (char*)name;
+ wchar_t *wname, *d;
+ int c, fd;
+ d = wname = fz_malloc(ctx, (strlen(name)+1) * sizeof(wchar_t));
+ while (*s) {
+ s += fz_chartorune(&c, s);
+ *d++ = c;
+ }
+ *d = 0;
+ fd = _wopen(wname, O_BINARY | O_RDONLY, 0);
+ fz_free(ctx, wname);
+#else
int fd = open(name, O_BINARY | O_RDONLY, 0);
+#endif
if (fd == -1)
fz_throw(ctx, "cannot open %s", name);
return fz_open_fd(ctx, fd);