Skip to content

Commit c2b96ca

Browse files
committed
Fix the bug when the game doesn't launch bc of one or more whitespace(s) in some arguments (for instance the game path) on old version because of a too early remapping of the arguments done before a split
1 parent daed996 commit c2b96ca

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/main/java/fr/flowarg/openlauncherlib/NoFramework.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private String getClassPath(JSONObject vanilla, JSONObject modLoader)
255255
this.appendLibraries(cp, modLoader);
256256
this.appendLibraries(cp, vanilla);
257257

258-
cp.add(this.gameDir.toAbsolutePath().resolve(this.clientJar).toString());
258+
cp.add(this.gameDir.resolve(this.clientJar).toAbsolutePath().toString());
259259

260260
return this.toString(cp);
261261
}
@@ -315,7 +315,14 @@ private List<String> getArguments(JSONObject object, Parameters parameters)
315315
{
316316
if(object.isNull("minecraftArguments"))
317317
return new ArrayList<>();
318-
else return Arrays.asList(this.map(object.getString("minecraftArguments"), parameters).split(" "));
318+
else
319+
{
320+
final String[] arguments = object.getString("minecraftArguments").split(" ");
321+
final List<String> result = new ArrayList<>();
322+
for (String argument : arguments)
323+
result.add(this.map(argument, parameters));
324+
return result;
325+
}
319326
}
320327
else
321328
{

src/main/java/fr/theshark34/openlauncherlib/external/ExternalLauncher.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,11 @@ public Process launch() throws LaunchException
137137
vmArgs.addAll(profile.getArgs());
138138

139139
if (profile.getDirectory() != null)
140-
builder.directory(profile.getDirectory().toFile());
140+
builder.directory(profile.getDirectory().toAbsolutePath().toFile());
141141

142-
if (profile.isRedirectErrorStream())
143-
builder.redirectErrorStream(true);
142+
builder.redirectErrorStream(true);
143+
builder.redirectError(ProcessBuilder.Redirect.INHERIT);
144+
builder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
144145

145146
if (launchingEvent != null)
146147
launchingEvent.onLaunching(builder);

0 commit comments

Comments
 (0)