@@ -81,31 +81,33 @@ void JvmLauncher::setJavaCmd(const string cmdPath) {
81
81
bool JvmLauncher::checkJava (const char *path, const char *prefix) {
82
82
assert (path);
83
83
assert (prefix);
84
- logMsg (" checkJava(%s)" , path);
85
- javaPath = path;
86
- if (*javaPath.rbegin () == ' \\ ' ) {
87
- javaPath.erase (javaPath.length () - 1 , 1 );
84
+ logMsg (" checkJava('%s', '%s')" , path, prefix);
85
+
86
+ std::string tmp (path);
87
+
88
+ if (*tmp.rbegin () == ' \\ ' ) {
89
+ tmp.erase (tmp.length () - 1 , 1 );
88
90
}
89
- javaExePath = javaPath + prefix + JAVA_EXE_FILE;
90
- javawExePath = javaPath + prefix + JAVAW_EXE_FILE;
91
- javaClientDllPath = javaPath + prefix + JAVA_CLIENT_DLL_FILE;
92
- javaServerDllPath = javaPath + prefix + JAVA_SERVER_DLL_FILE;
91
+ javaExePath = tmp + prefix + JAVA_EXE_FILE;
92
+ javawExePath = tmp + prefix + JAVAW_EXE_FILE;
93
+ javaClientDllPath = tmp + prefix + JAVA_CLIENT_DLL_FILE;
94
+ javaServerDllPath = tmp + prefix + JAVA_SERVER_DLL_FILE;
93
95
if (!fileExists (javaClientDllPath.c_str ())) {
94
96
javaClientDllPath = " " ;
95
97
}
96
98
if (!fileExists (javaServerDllPath.c_str ())) {
97
99
javaServerDllPath = " " ;
98
100
}
99
- javaBinPath = javaPath + prefix + JAVA_BIN_DIR;
101
+ javaBinPath = tmp + prefix + JAVA_BIN_DIR;
100
102
if (fileExists (javaExePath.c_str ()) || !javaClientDllPath.empty () || !javaServerDllPath.empty ()) {
101
103
if (!fileExists (javawExePath.c_str ())) {
102
104
logMsg (" javaw.exe not exists, forcing java.exe" );
103
105
javawExePath = javaExePath;
104
106
}
107
+ javaPath = tmp;
105
108
return true ;
106
109
}
107
110
108
- javaPath.clear ();
109
111
javaBinPath.clear ();
110
112
javaExePath.clear ();
111
113
javawExePath.clear ();
0 commit comments