summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-07-15 18:59:28 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-07-15 18:59:28 -0700
commit1466080199c9e102515b8a0820d97eed86a8f678 (patch)
tree08330f95c387ee8584ff0c2e688bc14dbeb5392e /compat/mingw.c
parentMerge branch 'js/maint-pretty-mailmap' (diff)
parenthelp (Windows): Display HTML in default browser using Windows' shell API (diff)
downloadtgif-1466080199c9e102515b8a0820d97eed86a8f678.tar.xz
Merge branch 'js/more-win'
* js/more-win: help (Windows): Display HTML in default browser using Windows' shell API help.c: Add support for htmldir relative to git_exec_path() Move code interpreting path relative to exec-dir to new function system_path()
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c22
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);
+}