mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 18:22:16 +00:00
Merge pull request #635 from csware/win32-utf8
GetFileAttributes does not work for utf-8 encoded paths
This commit is contained in:
commit
e8dc508f6a
10
src/path.c
10
src/path.c
@ -9,6 +9,7 @@
|
||||
#include "posix.h"
|
||||
#ifdef GIT_WIN32
|
||||
#include "win32/dir.h"
|
||||
#include "win32/posix.h"
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
@ -362,20 +363,11 @@ int git_path_exists(const char *path)
|
||||
|
||||
int git_path_isdir(const char *path)
|
||||
{
|
||||
#ifdef GIT_WIN32
|
||||
DWORD attr = GetFileAttributes(path);
|
||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
||||
return GIT_ERROR;
|
||||
|
||||
return (attr & FILE_ATTRIBUTE_DIRECTORY) ? GIT_SUCCESS : GIT_ERROR;
|
||||
|
||||
#else
|
||||
struct stat st;
|
||||
if (p_stat(path, &st) < GIT_SUCCESS)
|
||||
return GIT_ERROR;
|
||||
|
||||
return S_ISDIR(st.st_mode) ? GIT_SUCCESS : GIT_ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
int git_path_isfile(const char *path)
|
||||
|
Loading…
Reference in New Issue
Block a user