mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
implement a few classpath methods required by SWT for Win32
This commit is contained in:
parent
7aecdb6ce0
commit
75d4a4ff96
@ -163,6 +163,21 @@ Java_java_io_File_delete(JNIEnv* e, jclass, jstring path)
|
||||
return r == 0;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jboolean JNICALL
|
||||
Java_java_io_File_isDirectory(JNIEnv* e, jclass, jstring path)
|
||||
{
|
||||
const char* chars = e->GetStringUTFChars(path, 0);
|
||||
if (chars) {
|
||||
STRUCT_STAT s;
|
||||
int r = STAT(chars, &s);
|
||||
bool v = (r == 0 and S_ISDIR(s.st_mode));
|
||||
e->ReleaseStringUTFChars(path, chars);
|
||||
return v;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jboolean JNICALL
|
||||
Java_java_io_File_exists(JNIEnv* e, jclass, jstring path)
|
||||
{
|
||||
|
@ -23,6 +23,12 @@ public class File {
|
||||
this(parent.getPath() + FileSeparator + child);
|
||||
}
|
||||
|
||||
private static native boolean isDirectory(String path);
|
||||
|
||||
public boolean isDirectory() {
|
||||
return isDirectory(path);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
int index = path.lastIndexOf(FileSeparator);
|
||||
if (index >= 0) {
|
||||
|
@ -37,6 +37,10 @@ public final class Byte extends Number implements Comparable<Byte> {
|
||||
return toString(v, 10);
|
||||
}
|
||||
|
||||
public static byte parseByte(String s) {
|
||||
return (byte) Integer.parseInt(s);
|
||||
}
|
||||
|
||||
public byte byteValue() {
|
||||
return value;
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ public class Runtime {
|
||||
|
||||
public native long freeMemory();
|
||||
|
||||
public native long totalMemory();
|
||||
|
||||
private static class MyProcess extends Process {
|
||||
private int pid;
|
||||
private final int in;
|
||||
|
@ -561,6 +561,13 @@ Java_java_lang_Runtime_freeMemory(Thread*, jobject)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jlong JNICALL
|
||||
Java_java_lang_Runtime_totalMemory(Thread*, jobject)
|
||||
{
|
||||
// todo
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jobject JNICALL
|
||||
Java_java_lang_Throwable_trace(Thread* t, jclass, jint skipCount)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user