Author: mturk
Date: Thu Apr 28 17:45:12 2011
New Revision: 1097561
URL: http://svn.apache.org/viewvc?rev=1097561&view=rev
Log:
OSX Vm.self
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/darwin/os.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/os.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/os.c?rev=1097561&r1=1097560&r2=1097561&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/os.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/os.c Thu Apr 28
17:45:12 2011
@@ -19,6 +19,7 @@
#include <sys/utsname.h>
#include <sys/param.h>
#include <sys/sysctl.h>
+#include <mach-o/dyld.h>
static int _sys_done = -1;
static struct utsname _sys_buf;
@@ -89,3 +90,18 @@ ACR_JNI_EXPORT(jstring, Os, getVersion)(
else
return CSTR_TO_JSTRING(_unknown);
}
+
+ACR_JNI_EXPORT(jstring, Vm, self)(JNI_STDARGS)
+{
+
+ char path[PATH_MAX];
+ uint32_t size = PATH_MAX;
+
+ if (_NSGetExecutablePath(path, &size) == 0) {
+ char real[PATH_MAX];
+ realpath(path, real);
+ return CSTR_TO_JSTRING(real);
+ }
+ else
+ return 0;
+}