mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 21:56:44 +00:00
Merge pull request #424 from carlosmn/access-unicode
Implment p_access and use it in git_fileutils_exists
This commit is contained in:
commit
ea4dad8ec4
@ -127,7 +127,7 @@ int git_futils_isfile(const char *path)
|
||||
int git_futils_exists(const char *path)
|
||||
{
|
||||
assert(path);
|
||||
return access(path, F_OK);
|
||||
return p_access(path, F_OK);
|
||||
}
|
||||
|
||||
git_off_t git_futils_filesize(git_file fd)
|
||||
|
@ -52,6 +52,7 @@ extern char* p_getenv(const char* name);
|
||||
#define p_chdir(p) chdir(p)
|
||||
#define p_rmdir(p) rmdir(p)
|
||||
#define p_chmod(p,m) chmod(p, m)
|
||||
#define p_access(p,m) access(p,m)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -43,6 +43,6 @@ extern int p_stat(const char* path, struct stat* buf);
|
||||
extern int p_chdir(const char* path);
|
||||
extern int p_chmod(const char* path, int mode);
|
||||
extern int p_rmdir(const char* path);
|
||||
|
||||
extern int p_access(const char* path, int mode);
|
||||
|
||||
#endif
|
||||
|
@ -401,3 +401,14 @@ int p_setenv(const char* name, const char* value, int overwrite)
|
||||
|
||||
return (SetEnvironmentVariableA(name, value) == 0 ? GIT_EOSERR : GIT_SUCCESS);
|
||||
}
|
||||
|
||||
int p_access(const char* path, int mode)
|
||||
{
|
||||
wchar_t *buf = conv_utf8_to_utf16(path);
|
||||
int ret;
|
||||
|
||||
ret = _waccess(buf, mode);
|
||||
free(buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user