2
2
Launch4j (http://launch4j.sourceforge.net/)
3
3
Cross-platform Java application wrapper for creating Windows native executables.
4
4
5
- Copyright (c) 2004, 2015 Grzegorz Kowal,
5
+ Copyright (c) 2004, 2019 Grzegorz Kowal,
6
6
Ian Roberts (jdk preference patch)
7
7
Sylvain Mina (single instance patch)
8
8
@@ -914,7 +914,7 @@ void setWorkingDirectory(const char *exePath, const int pathLen)
914
914
BOOL bundledJreSearch (const char * exePath , const int pathLen )
915
915
{
916
916
debugAll ("bundledJreSearch()\n" );
917
- char tmpPath [_MAX_PATH ] = {0 };
917
+ char jrePathSpec [_MAX_PATH ] = {0 };
918
918
BOOL is64BitJre = loadBool (BUNDLED_JRE_64_BIT );
919
919
920
920
if (!wow64 && is64BitJre )
@@ -923,30 +923,36 @@ BOOL bundledJreSearch(const char *exePath, const int pathLen)
923
923
return FALSE;
924
924
}
925
925
926
- if (loadString (JRE_PATH , tmpPath ))
926
+ if (loadString (JRE_PATH , jrePathSpec ))
927
927
{
928
928
char jrePath [MAX_ARGS ] = {0 };
929
- expandVars (jrePath , tmpPath , exePath , pathLen );
930
- debug ("Bundled JRE:\t%s\n" , jrePath );
931
-
932
- if (jrePath [0 ] == '\\' || jrePath [1 ] == ':' )
933
- {
934
- // Absolute
935
- strcpy (launcher .cmd , jrePath );
936
- }
937
- else
938
- {
939
- // Relative
940
- strncpy (launcher .cmd , exePath , pathLen );
941
- appendPath (launcher .cmd , jrePath );
942
- }
943
-
944
- if (isLauncherPathValid (launcher .cmd ))
945
- {
946
- search .foundJava = is64BitJre ? FOUND_BUNDLED | KEY_WOW64_64KEY : FOUND_BUNDLED ;
947
- strcpy (search .foundJavaHome , launcher .cmd );
948
- return TRUE;
949
- }
929
+ expandVars (jrePath , jrePathSpec , exePath , pathLen );
930
+ debug ("Bundled JRE(s):\t%s\n" , jrePath );
931
+ char * path = strtok (jrePath , ";" );
932
+
933
+ while (path != NULL )
934
+ {
935
+ if (* path == '\\' || (* path != '\0' && * (path + 1 ) == ':' ))
936
+ {
937
+ // Absolute
938
+ strcpy (launcher .cmd , path );
939
+ }
940
+ else
941
+ {
942
+ // Relative
943
+ strncpy (launcher .cmd , exePath , pathLen );
944
+ appendPath (launcher .cmd , path );
945
+ }
946
+
947
+ if (isLauncherPathValid (launcher .cmd ))
948
+ {
949
+ search .foundJava = is64BitJre ? FOUND_BUNDLED | KEY_WOW64_64KEY : FOUND_BUNDLED ;
950
+ strcpy (search .foundJavaHome , launcher .cmd );
951
+ return TRUE;
952
+ }
953
+
954
+ path = strtok (NULL , ";" );
955
+ }
950
956
}
951
957
952
958
return FALSE;
0 commit comments