Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac1a5e2

Browse files
cswarecarlosmn
authored andcommitted
Make libgit2 work on Windows Vista again
(fixes issue libgit2#3316) Signed-off-by: Sven Strickroth <[email protected]>
1 parent 555b351 commit ac1a5e2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/path.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "win32/posix.h"
1313
#include "win32/buffer.h"
1414
#include "win32/w32_util.h"
15+
#include "win32/version.h"
1516
#else
1617
#include <dirent.h>
1718
#endif
@@ -1085,7 +1086,7 @@ int git_path_direach(
10851086
#if defined(GIT_WIN32) && !defined(__MINGW32__)
10861087

10871088
/* Using _FIND_FIRST_EX_LARGE_FETCH may increase performance in Windows 7
1088-
* and better. Prior versions will ignore this.
1089+
* and better.
10891090
*/
10901091
#ifndef FIND_FIRST_EX_LARGE_FETCH
10911092
# define FIND_FIRST_EX_LARGE_FETCH 2
@@ -1099,6 +1100,10 @@ int git_path_diriter_init(
10991100
git_win32_path path_filter;
11001101
git_buf hack = {0};
11011102

1103+
static int is_win7_or_later = -1;
1104+
if (is_win7_or_later < 0)
1105+
is_win7_or_later = git_has_win32_version(6, 1, 0);
1106+
11021107
assert(diriter && path);
11031108

11041109
memset(diriter, 0, sizeof(git_path_diriter));
@@ -1122,11 +1127,11 @@ int git_path_diriter_init(
11221127

11231128
diriter->handle = FindFirstFileExW(
11241129
path_filter,
1125-
FindExInfoBasic,
1130+
is_win7_or_later ? FindExInfoBasic : FindExInfoStandard,
11261131
&diriter->current,
11271132
FindExSearchNameMatch,
11281133
NULL,
1129-
FIND_FIRST_EX_LARGE_FETCH);
1134+
is_win7_or_later ? FIND_FIRST_EX_LARGE_FETCH : 0);
11301135

11311136
if (diriter->handle == INVALID_HANDLE_VALUE) {
11321137
giterr_set(GITERR_OS, "Could not open directory '%s'", path);

0 commit comments

Comments
 (0)