mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
fix java.io.File.delete() implementation for windows
This commit is contained in:
parent
b959a2a2f9
commit
a188b15f2e
@ -386,8 +386,17 @@ extern "C" JNIEXPORT void JNICALL
|
|||||||
Java_java_io_File_delete(JNIEnv* e, jclass, jstring path)
|
Java_java_io_File_delete(JNIEnv* e, jclass, jstring path)
|
||||||
{
|
{
|
||||||
string_t chars = getChars(e, path);
|
string_t chars = getChars(e, path);
|
||||||
|
int r;
|
||||||
if (chars) {
|
if (chars) {
|
||||||
int r = REMOVE(chars);
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
if (GetFileAttributes(chars) == FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
|
r = !RemoveDirectory(chars);
|
||||||
|
} else {
|
||||||
|
r = REMOVE(chars);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
r = REMOVE(chars);
|
||||||
|
#endif
|
||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
throwNewErrno(e, "java/io/IOException");
|
throwNewErrno(e, "java/io/IOException");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user