mirror of
https://github.com/corda/corda.git
synced 2025-01-01 02:36:44 +00:00
fix java.io.File.delete() implementation for windows
This commit is contained in:
parent
b959a2a2f9
commit
a188b15f2e
@ -383,11 +383,20 @@ extern "C" JNIEXPORT jboolean JNICALL
|
||||
}
|
||||
|
||||
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);
|
||||
int r;
|
||||
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) {
|
||||
throwNewErrno(e, "java/io/IOException");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user