summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bdab8bc)
raw | patch | inline | side by side (parent: bdab8bc)
author | ishmal <ishmal@users.sourceforge.net> | |
Thu, 3 Apr 2008 03:17:12 +0000 (03:17 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Thu, 3 Apr 2008 03:17:12 +0000 (03:17 +0000) |
src/bind/java/org/inkscape/cmn/Gateway.java | patch | blob | history | |
src/bind/javabind.cpp | patch | blob | history |
diff --git a/src/bind/java/org/inkscape/cmn/Gateway.java b/src/bind/java/org/inkscape/cmn/Gateway.java
index d1fa47a2b9efb15e2436ac0830291d9bb9061ab3..fa70d2b7d31552eaa5ee31aff723ca1f4a148607 100644 (file)
/**
* Serialize an XML Document to a string
*/
-String docToString(Document doc)
+public String docToString(Document doc)
{
if (doc == null)
return "";
diff --git a/src/bind/javabind.cpp b/src/bind/javabind.cpp
index 6bffe0cd71fce728752a207c2286026468da2df2..c62981f1f09ce577fd7a2539085656da11e8a813 100644 (file)
--- a/src/bind/javabind.cpp
+++ b/src/bind/javabind.cpp
NULL
};
+
+static String getExePath()
+{
+ char exeName[80];
+ GetModuleFileName(NULL, exeName, 80);
+ char *slashPos = strrchr(exeName, '\\');
+ if (slashPos)
+ *slashPos = '\0';
+ String s = exeName;
+ return s;
+}
+
+
+static String checkPathUnderRoot(const String &root)
+{
+ for (const char **path = commonJavaPaths ; *path ; path++)
+ {
+ String jpath = root;
+ jpath.append(*path);
+ //msg("trying '%s'", jpath.c_str());
+ struct stat finfo;
+ if (stat(jpath.c_str(), &finfo)>=0)
+ {
+ //msg("found");
+ return jpath;
+ }
+ }
+ return "";
+}
+
+
+
static CreateVMFunc getCreateVMFunc()
{
bool found = false;
String libname;
/**
- * First, look for JAVA_HOME. This will allow the user
+ * First, look for an embedded jre in the $INKSCAPE dir.
+ * This allows us to package our own JRE if we want to.
+ */
+ String inkscapeHome = getExePath();
+ inkscapeHome.append("\\jre");
+ msg("INKSCAPE_HOME='%s'", inkscapeHome.c_str());
+ String path = checkPathUnderRoot(inkscapeHome);
+ if (path.size() > 0)
+ {
+ libname = path;
+ found = true;
+ }
+
+ /**
+ * Next, look for JAVA_HOME. This will allow the user
* to override what's in the registry
- */
- const char *envStr = getenv("JAVA_HOME");
- if (envStr)
+ */
+ if (!found)
{
- String javaHome = cleanPath(envStr);
- msg("JAVA_HOME='%s'", javaHome.c_str());
- for (const char **path = commonJavaPaths ; *path ; path++)
+ const char *envStr = getenv("JAVA_HOME");
+ if (envStr)
{
- String jpath = javaHome;
- jpath.append(*path);
- //msg("trying '%s'", jpath.c_str());
- struct stat finfo;
- if (stat(jpath.c_str(), &finfo)>=0)
+ String javaHome = cleanPath(envStr);
+ msg("JAVA_HOME='%s'", javaHome.c_str());
+ path = checkPathUnderRoot(javaHome);
+ if (path.size() > 0)
{
- //msg("found");
- libname = jpath;
+ libname = path;
found = true;
- break;
}
}
}
static void getJavaRoot(String &javaroot)
{
- char exeName[80];
- GetModuleFileName(NULL, exeName, 80);
- char *slashPos = strrchr(exeName, '\\');
- if (slashPos)
- *slashPos = '\0';
- javaroot = exeName;
+ javaroot = getExePath();
javaroot.append("\\");
javaroot.append(INKSCAPE_BINDDIR);
javaroot.append("\\java");