File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -932,16 +932,33 @@ BOOL bundledJreSearch(const char *exePath, const int pathLen)
932
932
933
933
while (path != NULL )
934
934
{
935
- if (* path == '\\' || (* path != '\0' && * (path + 1 ) == ':' ))
935
+ char pathNoBin [_MAX_PATH ] = {0 };
936
+ char * lastBackslash = strrchr (path , '\\' );
937
+ char * lastSlash = strrchr (path , '/' );
938
+
939
+ if (lastBackslash != NULL && strcasecmp (lastBackslash , "\\bin" ) == 0 )
940
+ {
941
+ strncpy (pathNoBin , path , lastBackslash - path );
942
+ }
943
+ else if (lastSlash != NULL && strcasecmp (lastSlash , "/bin" ) == 0 )
944
+ {
945
+ strncpy (pathNoBin , path , lastSlash - path );
946
+ }
947
+ else
948
+ {
949
+ strcpy (pathNoBin , path );
950
+ }
951
+
952
+ if (* pathNoBin == '\\' || (* pathNoBin != '\0' && * (pathNoBin + 1 ) == ':' ))
936
953
{
937
954
// Absolute
938
- strcpy (launcher .cmd , path );
955
+ strcpy (launcher .cmd , pathNoBin );
939
956
}
940
957
else
941
958
{
942
959
// Relative
943
960
strncpy (launcher .cmd , exePath , pathLen );
944
- appendPath (launcher .cmd , path );
961
+ appendPath (launcher .cmd , pathNoBin );
945
962
}
946
963
947
964
if (isLauncherPathValid (launcher .cmd ))
You can’t perform that action at this time.
0 commit comments