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

Refactored how location of the game is aquired to a simpler version. #180

Merged
merged 1 commit into from
Mar 18, 2021
Merged

Refactored how location of the game is aquired to a simpler version. #180

merged 1 commit into from
Mar 18, 2021

Conversation

FlameHorizon
Copy link
Contributor

@FlameHorizon FlameHorizon commented Mar 2, 2021

Understating how FF8Dir is created

Basic information

FF8Dir is a variable which stores root directory of Final Fantasy 8 game.

Depends on the OS, different strategy will be used to get that root directory. Now, there are two supported OSes: Windows and Linux.

Windows take on finding root directory

Algorithm first checks, if GameLocation is in array of hardcoded paths defined in HardcodedGameLocationProvider. If that is not the case, game checks into registers to find game location.

If game location wasn't found in also registers, game throws DirectoryNotFoundException.

Linux take on finding root directory

In case of Linux, game just check for hardcoded paths using HardcodedGameLocationProvider. If game location wasn't found throws DirectoryNotFoundException.

Metrics

To find a path to the game game uses following classes:

  • WindowsGameLocationProvider
  • IGameLocationProvider
  • GameLocation
  • LinuxGameLocationProvider
  • HardcodedGameLocationProvider

Number of lines in these classes:

Name Lines
GameLocation 43
WindowsGameLocationProvider 82
IGameLocationProvider 7
LinuxGameLocationProvider 25
HardcodedGameLocationProvider 42

In total of 199 lines of code.

I think I can make it simpler.

Copy link
Owner

@MaKiPL MaKiPL left a comment

Choose a reason for hiding this comment

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

I'm also not a fan of dividing code into five classes. Thank you for comitting! Merging! <3
btw> that linux algorithm is just a disaster- I'll make new issue about it

@MaKiPL MaKiPL merged commit 22eb63e into MaKiPL:master Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants