Skip to content
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

Handle unexpected (old or weird) OSes that may not support our directory detection. #3823

Merged
merged 4 commits into from
Feb 19, 2020

Conversation

sladyn98
Copy link
Contributor

Contains

This PR deals with errors thrown during directory detection, specifically giving a chance to run the game again if the default directory detection fails.
In case of headless servers we have defaulted to choosing the home path as the current directory.
Fixes #3566

How to test

Run the game on Windows XP. If you can find something with XP on it or a wierd OS that throws our directory detection out of the window.

Outstanding before merging

If anything. You can use neat checkboxes! Feel free to delete if not needed

  • [ x ] Still have to adjust the wiki doc
    The doc has to be updated if in case we hit any such OSes in the future.

Sladyn added 2 commits January 9, 2020 19:22
…sXP. Giving the user a second chance to run the game.

Added a headless server condition to set the homepath as current directory.
@GooeyHub
Copy link
Member

Can one of the admins please verify this patch?

@Qwertygiy
Copy link
Contributor

@GooeyHub add to whitelist.

} catch (IOException ex) {
reportException(e);
System.exit(0);
}
System.exit(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be taken out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should 👍

* Gives user the option to manually choose home path.
* @throws IOException Thrown when required directories cannot be accessed.
*/
public void chooseHomePathManually() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should/can this be part of useDefaultHomePath?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be but then it would have to catch the exception inside the useDefaultHomePath, moreover this provides a much modular approach and a generic solution to all further weird OSeS

@@ -363,7 +364,12 @@ private static void handleLaunchArguments(String[] args) {

} catch (IOException e) {
reportException(e);
System.exit(0);
try {
PathManager.getInstance().chooseHomePathManually();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this can recover any exception that was thrown before, there is no need to reportException before trying the backup. At least, it should not be reported as an error (maybe as a warning, or probably just on INFO level).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah , you have a valid point I just thought that it would be good to report an exception without stopping execution. A Warning sounds like a much better approach :)

Copy link
Member

@skaldarnar skaldarnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for incorporating the requested changes and replying to the questions 😃

@skaldarnar skaldarnar added the Type: Improvement Request for or addition/enhancement of a feature label Feb 19, 2020
@skaldarnar skaldarnar added this to the v2.3.0 milestone Feb 19, 2020
@skaldarnar skaldarnar merged commit a9263f7 into MovingBlocks:develop Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Request for or addition/enhancement of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attempt to handle unexpected (old or weird) OSes that may not support our directory detection
5 participants