mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
Added user.home system property
This commit is contained in:
parent
db2b7e8fa7
commit
75c51bb5ec
@ -1,3 +1,5 @@
|
|||||||
|
#include "math.h"
|
||||||
|
#include "stdlib.h"
|
||||||
#include "sys/time.h"
|
#include "sys/time.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
@ -22,7 +24,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jint code)
|
|||||||
LineSeparator = 100,
|
LineSeparator = 100,
|
||||||
FileSeparator = 101,
|
FileSeparator = 101,
|
||||||
OsName = 102,
|
OsName = 102,
|
||||||
JavaIoTmpdir = 103
|
JavaIoTmpdir = 103,
|
||||||
|
UserHome = 104
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
@ -38,6 +41,14 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jint code)
|
|||||||
case JavaIoTmpdir:
|
case JavaIoTmpdir:
|
||||||
return e->NewStringUTF("/tmp");
|
return e->NewStringUTF("/tmp");
|
||||||
|
|
||||||
|
case UserHome:
|
||||||
|
return e->NewStringUTF("/home/scharff");
|
||||||
|
#ifdef WIN32
|
||||||
|
LPWSTR home = _wgetenv(L"USERPROFILE");
|
||||||
|
return JvNewString(reinterpret_cast<jchar*>(home), lstrlenW(home));
|
||||||
|
#else
|
||||||
|
return e->NewStringUTF(getenv("HOME"));
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
throwNew(e, "java/lang/RuntimeException", 0);
|
throwNew(e, "java/lang/RuntimeException", 0);
|
||||||
return 0;
|
return 0;
|
||||||
@ -70,7 +81,6 @@ Java_java_lang_System_doMapLibraryName(JNIEnv* e, jclass, jstring name)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
extern "C" JNIEXPORT jdouble JNICALL
|
extern "C" JNIEXPORT jdouble JNICALL
|
||||||
Java_java_lang_Math_floor(JNIEnv*, jclass, jdouble val)
|
Java_java_lang_Math_floor(JNIEnv*, jclass, jdouble val)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ public abstract class System {
|
|||||||
private static final int FileSeparator = 101;
|
private static final int FileSeparator = 101;
|
||||||
private static final int OsName = 102;
|
private static final int OsName = 102;
|
||||||
private static final int JavaIoTmpdir = 103;
|
private static final int JavaIoTmpdir = 103;
|
||||||
|
private static final int UserHome = 104;
|
||||||
|
|
||||||
private static Property properties;
|
private static Property properties;
|
||||||
|
|
||||||
@ -50,6 +51,8 @@ public abstract class System {
|
|||||||
code = LineSeparator;
|
code = LineSeparator;
|
||||||
} else if (name.equals("file.separator")) {
|
} else if (name.equals("file.separator")) {
|
||||||
code = FileSeparator;
|
code = FileSeparator;
|
||||||
|
} else if (name.equals("user.home")) {
|
||||||
|
code = UserHome;
|
||||||
} else if (name.equals("os.name")) {
|
} else if (name.equals("os.name")) {
|
||||||
code = OsName;
|
code = OsName;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user