use _waccess on windows to implement File.can{Read|Write}

This commit is contained in:
Joel Dice 2010-09-12 14:46:14 -06:00
parent d5b35bea6e
commit 74a87a7f4f

View File

@ -25,6 +25,7 @@
# include <direct.h>
# include <share.h>
# define ACCESS _waccess
# define CLOSE _close
# define READ _read
# define WRITE _write
@ -56,6 +57,7 @@ typedef wchar_t char_t;
# include <unistd.h>
# include "sys/mman.h"
# define ACCESS access
# define OPEN open
# define CLOSE close
# define READ read
@ -382,7 +384,7 @@ Java_java_io_File_canRead(JNIEnv* e, jclass, jstring path)
{
string_t chars = getChars(e, path);
if (chars) {
int r = access(chars, R_OK);
int r = ACCESS(chars, R_OK);
releaseChars(e, path, chars);
return (r == 0);
}
@ -394,7 +396,7 @@ Java_java_io_File_canWrite(JNIEnv* e, jclass, jstring path)
{
string_t chars = getChars(e, path);
if (chars) {
int r = access(chars, W_OK);
int r = ACCESS(chars, W_OK);
releaseChars(e, path, chars);
return (r == 0);
}