mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
use _waccess on windows to implement File.can{Read|Write}
This commit is contained in:
parent
d5b35bea6e
commit
74a87a7f4f
@ -25,6 +25,7 @@
|
|||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
# include <share.h>
|
# include <share.h>
|
||||||
|
|
||||||
|
# define ACCESS _waccess
|
||||||
# define CLOSE _close
|
# define CLOSE _close
|
||||||
# define READ _read
|
# define READ _read
|
||||||
# define WRITE _write
|
# define WRITE _write
|
||||||
@ -56,6 +57,7 @@ typedef wchar_t char_t;
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include "sys/mman.h"
|
# include "sys/mman.h"
|
||||||
|
|
||||||
|
# define ACCESS access
|
||||||
# define OPEN open
|
# define OPEN open
|
||||||
# define CLOSE close
|
# define CLOSE close
|
||||||
# define READ read
|
# define READ read
|
||||||
@ -382,7 +384,7 @@ Java_java_io_File_canRead(JNIEnv* e, jclass, jstring path)
|
|||||||
{
|
{
|
||||||
string_t chars = getChars(e, path);
|
string_t chars = getChars(e, path);
|
||||||
if (chars) {
|
if (chars) {
|
||||||
int r = access(chars, R_OK);
|
int r = ACCESS(chars, R_OK);
|
||||||
releaseChars(e, path, chars);
|
releaseChars(e, path, chars);
|
||||||
return (r == 0);
|
return (r == 0);
|
||||||
}
|
}
|
||||||
@ -394,7 +396,7 @@ Java_java_io_File_canWrite(JNIEnv* e, jclass, jstring path)
|
|||||||
{
|
{
|
||||||
string_t chars = getChars(e, path);
|
string_t chars = getChars(e, path);
|
||||||
if (chars) {
|
if (chars) {
|
||||||
int r = access(chars, W_OK);
|
int r = ACCESS(chars, W_OK);
|
||||||
releaseChars(e, path, chars);
|
releaseChars(e, path, chars);
|
||||||
return (r == 0);
|
return (r == 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user