mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add subsurface_access()
For our usage the method will acept UTF-8 paths, which are converted to UTF-16 on Win32. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
61dc19d2e0
commit
4096383fb5
5 changed files with 26 additions and 2 deletions
13
windows.c
13
windows.c
|
@ -1,5 +1,6 @@
|
|||
/* windows.c */
|
||||
/* implements Windows specific functions */
|
||||
#include <io.h>
|
||||
#include "dive.h"
|
||||
#include "display.h"
|
||||
#undef _WIN32_WINNT
|
||||
|
@ -235,6 +236,18 @@ void *subsurface_opendir(const char *path)
|
|||
return (void *)ret;
|
||||
}
|
||||
|
||||
int subsurface_access(const char *path, int mode)
|
||||
{
|
||||
int ret = -1;
|
||||
if (!path)
|
||||
return ret;
|
||||
wchar_t *wpath = utf8_to_utf16(path);
|
||||
if (wpath)
|
||||
ret = _waccess(wpath, mode);
|
||||
free((void *)wpath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue