diff options
author | Steffen Prohaska <prohaska@zib.de> | 2008-07-13 22:31:19 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-07-13 14:41:28 -0700 |
commit | 868da8d5e329c951f0d0cd049a8f9fecda64d388 (patch) | |
tree | 18d55f27096c7ac73827e0b9dc55ed921b886846 | |
parent | Move code interpreting path relative to exec-dir to new function system_path() (diff) | |
download | tgif-868da8d5e329c951f0d0cd049a8f9fecda64d388.tar.xz |
help.c: Add support for htmldir relative to git_exec_path()
If htmldir (in the Makefile) is a relative path, this path will now be
interpreted relative to git_exec_path. This can be used to create an
installation that can be moved to a different directory without
re-compiling. The Windows installer (msysgit) is an example for such
a setup.
Note that the Makefile maps htmldir to the define GIT_HTML_PATH.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | help.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -633,13 +633,15 @@ static void show_info_page(const char *git_cmd) static void get_html_page_path(struct strbuf *page_path, const char *page) { struct stat st; + const char *html_path = system_path(GIT_HTML_PATH); /* Check that we have a git documentation directory. */ - if (stat(GIT_HTML_PATH "/git.html", &st) || !S_ISREG(st.st_mode)) - die("'%s': not a documentation directory.", GIT_HTML_PATH); + if (stat(mkpath("%s/git.html", html_path), &st) + || !S_ISREG(st.st_mode)) + die("'%s': not a documentation directory.", html_path); strbuf_init(page_path, 0); - strbuf_addf(page_path, GIT_HTML_PATH "/%s.html", page); + strbuf_addf(page_path, "%s/%s.html", html_path, page); } static void show_html_page(const char *git_cmd) |