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

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

Closed
Cervator opened this issue Dec 2, 2018 · 7 comments · Fixed by #3823
Labels
Good First Issue Good for learners that are new to Terasology Status: Needs Discussion Requires help discussing a reported issue or provided PR Topic: Architecture Requests, Issues and Changes related to software architecture, programming patterns, etc.
Milestone

Comments

@Cervator
Copy link
Member

Cervator commented Dec 2, 2018

What you were trying to do

A user attempted to run the game on a Windows XP system. Yes, WinXP still exists. No, it isn't likely to run the game well even if it didn't instantly crash :-)

It made me think though that there might be other current (or future) OSes we might encounter and maybe we can harden the process for a second chance at being able to run the game.

What actually happened

Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'SHGetKnownFolderPath': The specified procedure could not be found. - apparently XP can't handle the Windows specific call trying to get a default directory to store game data.

How to reproduce

  • Run the game on Windows XP. If you can find something with XP on it

Possible improvement

I've come up with two brief ideas that might be able to get around this issue, which is namely using native/OS specific code trying to get a game data dir to call default.

  • If path detection fails fall back on showing the user a popup asking for a valid path to use (similar to what the game launcher does) - so wrap exception detection around the problematic call then attempt a fallback
  • If the user supplies -homedir then skip that whole part of the code. Update the docs to say if you hit an issue like that try to supply -homedir yourself
@Cervator Cervator added Status: Needs Discussion Requires help discussing a reported issue or provided PR Topic: Architecture Requests, Issues and Changes related to software architecture, programming patterns, etc. labels Dec 2, 2018
@syntaxi syntaxi added the Good First Issue Good for learners that are new to Terasology label Feb 5, 2019
@sladyn98
Copy link
Contributor

sladyn98 commented Jan 9, 2020

@Cervator Looks like a good beginner issue to work on. Can I start working on this

@Adrijaned
Copy link
Member

Hi @sladyn98, feel free to start working on this, as as far as I know noone else is yet.

@sladyn98
Copy link
Contributor

sladyn98 commented Jan 9, 2020

My plan was to add a FileChooser to the above point and instead of catching an IO Exception would catch a general Exception, thereby catching the OS error.This would give the user a chance to select the file path and thus proceed normally.
JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());

@DarkWeird
Copy link
Contributor

@sladyn98 its will be problem in headless server

@sladyn98
Copy link
Contributor

sladyn98 commented Jan 10, 2020

@DarkWeird So in that case we could use the fallback path that has been defined for the operating system. And according to the flow the default paths are tried first.

if (homePath != null) {
                PathManager.getInstance().useOverrideHomePath(homePath);
            } else {
                PathManager.getInstance().useDefaultHomePath();
            }

After this we prompt the user for the path, in a headless server since we cannot interact we can fallback to the using the currentDir or the default home for the OS.

@DarkWeird
Copy link
Contributor

@sladyn98
I don't think what use homedir - pretty idea.
Looks like game files directly in homedir.
I think problem must be resolved in PathManager (looks like problem with detect default OS directory)

@sladyn98
Copy link
Contributor

I think problem must be resolved in PathManager (looks like problem with detect default OS directory)

Oh okay so could we add a try block around that code and in the catch block we prompt the user to enter the file path using FileChooser, for headless servers we just use the current directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for learners that are new to Terasology Status: Needs Discussion Requires help discussing a reported issue or provided PR Topic: Architecture Requests, Issues and Changes related to software architecture, programming patterns, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants