diff options
Diffstat (limited to 'compat/mingw.c')
-rw-r--r-- | compat/mingw.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c index 3a05fe7da6..c0bc849e45 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1017,3 +1017,25 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler) timer_fn = handler; return old; } + +static const char *make_backslash_path(const char *path) +{ + static char buf[PATH_MAX + 1]; + char *c; + + if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) + die("Too long path: %.*s", 60, path); + + for (c = buf; *c; c++) { + if (*c == '/') + *c = '\\'; + } + return buf; +} + +void mingw_open_html(const char *unixpath) +{ + const char *htmlpath = make_backslash_path(unixpath); + printf("Launching default browser to display HTML ...\n"); + ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0); +} |