Revert "display HTML in default browser using Windows' shell API"
Since 4804aab
(help (Windows): Display HTML in default browser using
Windows' shell API, 2008-07-13), Git for Windows used to call
`ShellExecute()` to launch the default Windows handler for `.html`
files.
The idea was to avoid going through a shell script, for performance
reasons.
However, this change ignores the `help.browser` config setting. Together
with browsing help not being a performance-critical operation, let's
just revert that patch.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0b65a8dbdb
commit
6db5967d4e
@ -379,17 +379,10 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
|
|||||||
free(to_free);
|
free(to_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If open_html is not defined in a platform-specific way (see for
|
|
||||||
* example compat/mingw.h), we use the script web--browse to display
|
|
||||||
* HTML.
|
|
||||||
*/
|
|
||||||
#ifndef open_html
|
|
||||||
static void open_html(const char *path)
|
static void open_html(const char *path)
|
||||||
{
|
{
|
||||||
execl_git_cmd("web--browse", "-c", "help.browser", path, (char *)NULL);
|
execl_git_cmd("web--browse", "-c", "help.browser", path, (char *)NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void show_html_page(const char *git_cmd)
|
static void show_html_page(const char *git_cmd)
|
||||||
{
|
{
|
||||||
|
@ -1930,48 +1930,6 @@ int mingw_raise(int sig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
typedef HINSTANCE (WINAPI *T)(HWND, const char *,
|
|
||||||
const char *, const char *, const char *, INT);
|
|
||||||
T ShellExecute;
|
|
||||||
HMODULE shell32;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
shell32 = LoadLibrary("shell32.dll");
|
|
||||||
if (!shell32)
|
|
||||||
die("cannot load shell32.dll");
|
|
||||||
ShellExecute = (T)GetProcAddress(shell32, "ShellExecuteA");
|
|
||||||
if (!ShellExecute)
|
|
||||||
die("cannot run browser");
|
|
||||||
|
|
||||||
printf("Launching default browser to display HTML ...\n");
|
|
||||||
r = HCAST(int, ShellExecute(NULL, "open", htmlpath,
|
|
||||||
NULL, "\\", SW_SHOWNORMAL));
|
|
||||||
FreeLibrary(shell32);
|
|
||||||
/* see the MSDN documentation referring to the result codes here */
|
|
||||||
if (r <= 32) {
|
|
||||||
die("failed to launch browser for %.*s", MAX_PATH, unixpath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int link(const char *oldpath, const char *newpath)
|
int link(const char *oldpath, const char *newpath)
|
||||||
{
|
{
|
||||||
typedef BOOL (WINAPI *T)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
|
typedef BOOL (WINAPI *T)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
|
||||||
|
@ -414,9 +414,6 @@ int mingw_offset_1st_component(const char *path);
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void mingw_open_html(const char *path);
|
|
||||||
#define open_html mingw_open_html
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts UTF-8 encoded string to UTF-16LE.
|
* Converts UTF-8 encoded string to UTF-16LE.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user