-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: merge 'games' directory into launcher installation directory #536
feat: merge 'games' directory into launcher installation directory #536
Conversation
Signed-off-by: Tobias Nett <[email protected]>
Signed-off-by: Tobias Nett <[email protected]>
Signed-off-by: Tobias Nett <[email protected]>
TODO |
Signed-off-by: Tobias Nett <[email protected]>
Signed-off-by: Tobias Nett <[email protected]>
Signed-off-by: Tobias Nett <[email protected]>
Signed-off-by: Tobias Nett <[email protected]>
launcherInitTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() { | ||
@Override | ||
public void handle(final WorkerStateEvent workerStateEvent) { | ||
try { | ||
LauncherConfiguration config = launcherInitTask.getValue(); | ||
if (config == null) { | ||
throw new LauncherStartFailedException("Launcher configuration was `null`."); | ||
} else if (config instanceof NullLauncherConfiguration) { | ||
logger.info("Closing the launcher ... (empty configuration, probably due to update)"); | ||
Platform.exit(); | ||
} else { | ||
showMainStage(config); | ||
} | ||
} catch (IOException | LauncherStartFailedException e) { | ||
openCrashReporterAndExit(e); | ||
launcherInitTask.setOnSucceeded(workerStateEvent -> { | ||
try { | ||
LauncherConfiguration config = launcherInitTask.getValue(); | ||
if (config == null) { | ||
throw new LauncherStartFailedException("Launcher configuration was `null`."); | ||
} else if (config instanceof NullLauncherConfiguration) { | ||
logger.info("Closing the launcher ... (empty configuration, probably due to update)"); | ||
Platform.exit(); | ||
} else { | ||
showMainStage(config); | ||
} | ||
} catch (IOException | LauncherStartFailedException e) { | ||
openCrashReporterAndExit(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure this does the same?
Previous implementation of EventHandler
seems to me as if the workerStateEvent
may not yet be there when the launcherInitTask
succeeds? But maybe I'm reading this wrong...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just uses a different syntax (lambda expression) for creating the handler for the onSucceeded
event. As handle(WorkerStateEvent event)
is the only method that needs to be implemented we can use the simplified syntax here.
new EventHandler<WorkerStateEvent>() {
@Override
public void handle(final WorkerStateEvent workerStateEvent) {
// do something
}
}
Is replaced by
workerStateEvent -> {
// do something
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, so the new one also kind of "waits" for a workerStateEvent
to come in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for explaining the EventHandler stuff
Part of #469.
Take away the user choice for the game installation directory and place it directly in the launcher installation directory under
games
. Technically, this introducesGAMES
as launcher-managed directory and does not prompt the user for input.LauncherInitTask::getGameDirectory
and clean up labels, etc.<installDir>/games/games/...
for some reason 🙄