mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
fix access violation introduced in last commit
This commit is contained in:
parent
446c09dd33
commit
916c96c2b9
@ -346,14 +346,15 @@ Java_java_io_File_length(JNIEnv* e, jclass, jstring path)
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
LARGE_INTEGER fileSize;
|
||||
HANDLE file = CreateFileW((wchar_t *)e->GetStringChars(path, 0), FILE_READ_DATA, FILE_SHARE_READ, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
e->ReleaseStringChars(path, 0);
|
||||
string_t chars = getChars(e, path);
|
||||
HANDLE file = CreateFileW
|
||||
(chars, FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
|
||||
releaseChars(e, path, chars);
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
GetFileSizeEx(file, &fileSize);
|
||||
else return -1;
|
||||
else return 0;
|
||||
CloseHandle(file);
|
||||
return (jlong)fileSize.QuadPart;
|
||||
return static_cast<jlong>(fileSize.QuadPart);
|
||||
|
||||
#else
|
||||
|
||||
|
@ -10,6 +10,9 @@ public class Zip {
|
||||
for (File file: directory.listFiles()) {
|
||||
if (file.isFile()) {
|
||||
if (file.getName().endsWith(".jar")) {
|
||||
System.out.println
|
||||
("found " + file.getAbsolutePath() + " length " + file.length());
|
||||
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
} else if (file.isDirectory()) {
|
||||
|
Loading…
Reference in New Issue
Block a user