Can guess win32 git template dir
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/src/fileops.c b/src/fileops.c
index 4dfc8a5..b7ae94b 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -624,15 +624,25 @@ static int git_futils_guess_xdg_dirs(git_buf *out)
#endif
}
+static int git_futils_guess_template_dirs(git_buf *out)
+{
+#ifdef GIT_WIN32
+ return git_win32__find_system_dirs(out, L"share\\git-core\\templates");
+#else
+ return git_buf_sets(out, "/usr/share/git-core/templates");
+#endif
+}
+
typedef int (*git_futils_dirs_guess_cb)(git_buf *out);
static git_buf git_futils__dirs[GIT_FUTILS_DIR__MAX] =
- { GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT };
+ { GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT };
static git_futils_dirs_guess_cb git_futils__dir_guess[GIT_FUTILS_DIR__MAX] = {
git_futils_guess_system_dirs,
git_futils_guess_global_dirs,
git_futils_guess_xdg_dirs,
+ git_futils_guess_template_dirs,
};
int git_futils_dirs_global_init(void)
diff --git a/src/fileops.h b/src/fileops.h
index 02f79b9..0ac9b90 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -310,7 +310,8 @@ typedef enum {
GIT_FUTILS_DIR_SYSTEM = 0,
GIT_FUTILS_DIR_GLOBAL = 1,
GIT_FUTILS_DIR_XDG = 2,
- GIT_FUTILS_DIR__MAX = 3,
+ GIT_FUTILS_DIR_TEMPLATE = 3,
+ GIT_FUTILS_DIR__MAX = 4,
} git_futils_dir_t;
/**