Fix a few bugs in profilers.

* Legacy was launching before the profiler.
* Some clarity changes.
* Report problem with empty strings as profiler paths.
This commit is contained in:
Petr Mrázek
2014-02-16 00:10:45 +01:00
parent 8219dbf612
commit 7ceb2cacb1
6 changed files with 73 additions and 24 deletions

View File

@ -29,7 +29,8 @@ public class EntryPoint
private enum Action
{
Proceed,
Launch
Launch,
Abort
}
public static void main(String[] args)
@ -62,8 +63,17 @@ public class EntryPoint
{
String[] pair = inData.split(" ", 2);
if(pair.length == 1 && pair[0].equals("launch"))
return Action.Launch;
if(pair.length == 1)
{
String command = pair[0];
if (pair[0].equals("launch"))
return Action.Launch;
else if (pair[0].equals("abort"))
return Action.Abort;
else throw new ParseException();
}
if(pair.length != 2)
throw new ParseException();
@ -109,6 +119,7 @@ public class EntryPoint
return 1;
}
boolean isListening = true;
boolean isAborted = false;
// Main loop
while (isListening)
{
@ -119,7 +130,13 @@ public class EntryPoint
inData = buffer.readLine();
if (inData != null)
{
if(parseLine(inData) == Action.Launch)
Action a = parseLine(inData);
if(a == Action.Abort)
{
isListening = false;
isAborted = true;
}
if(a == Action.Launch)
{
isListening = false;
}
@ -138,6 +155,11 @@ public class EntryPoint
return 1;
}
}
if(isAborted)
{
System.err.println("Launch aborted by MultiMC.");
return 1;
}
if(m_launcher != null)
{
return m_launcher.launch(m_params);