use getcwd instead of getenv("PWD") to get working directory

PWD is not always set, whereas getcwd is more reliable.
This commit is contained in:
Joel Dice 2011-03-15 13:27:36 -06:00
parent e5ecb5b549
commit a3a7a7a2de

View File

@ -59,6 +59,7 @@ typedef int socklen_t;
#else // not PLATFORM_WINDOWS
# include <unistd.h>
# include <limits.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <sys/socket.h>
@ -2586,7 +2587,10 @@ jvmInitProperties(Thread* t, uintptr_t* arguments)
# endif
local::setProperty(t, method, *properties, "java.io.tmpdir", "/tmp");
local::setProperty(t, method, *properties, "user.home", getenv("HOME"));
local::setProperty(t, method, *properties, "user.dir", getenv("PWD"));
char buffer[PATH_MAX];
local::setProperty(t, method, *properties, "user.dir",
getcwd(buffer, PATH_MAX));
#endif
local::setProperty(t, method, *properties, "java.protocol.handler.pkgs",