mirror of
https://github.com/corda/corda.git
synced 2025-02-01 16:58:27 +00:00
use getcwd instead of getenv("PWD") to get workding directory
The PWD environment variable is not always set; getcwd is more reliable.
This commit is contained in:
parent
19d5022456
commit
272789cf16
@ -48,6 +48,7 @@
|
|||||||
# define SO_SUFFIX ".so"
|
# define SO_SUFFIX ".so"
|
||||||
# endif
|
# endif
|
||||||
# include "unistd.h"
|
# include "unistd.h"
|
||||||
|
# include "limits.h"
|
||||||
# include "sys/time.h"
|
# include "sys/time.h"
|
||||||
# include "sys/sysctl.h"
|
# include "sys/sysctl.h"
|
||||||
# include "sys/utsname.h"
|
# include "sys/utsname.h"
|
||||||
@ -590,7 +591,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
|
|||||||
} else if (strcmp(chars, "java.io.tmpdir") == 0) {
|
} else if (strcmp(chars, "java.io.tmpdir") == 0) {
|
||||||
r = e->NewStringUTF("/tmp");
|
r = e->NewStringUTF("/tmp");
|
||||||
} else if (strcmp(chars, "user.dir") == 0) {
|
} else if (strcmp(chars, "user.dir") == 0) {
|
||||||
r = e->NewStringUTF(getenv("PWD"));
|
char buffer[PATH_MAX];
|
||||||
|
r = e->NewStringUTF(getcwd(buffer, PATH_MAX));
|
||||||
} else if (strcmp(chars, "user.home") == 0) {
|
} else if (strcmp(chars, "user.home") == 0) {
|
||||||
r = e->NewStringUTF(getenv("HOME"));
|
r = e->NewStringUTF(getenv("HOME"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user