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

chore: restructure Platform #714

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

skaldarnar
Copy link
Member

@skaldarnar skaldarnar commented Nov 27, 2023

Contains

Restructure the Platform utility class and splits out OS and Arch as separate enums.

Loosely based on #708.

How to test

Nothing should change based on this PR.

Outstanding before merging

Gather opinions on whether we should split this up for more flexibility in modeling (that we probabyl don't need) or rather go the opposite way and have a more restrictive enum regarding supported platforms. See my discussion notes in the PR: https://github.com/MovingBlocks/TerasologyLauncher/pull/714/files#diff-9c6b18468622aa7d6c00cd8b643c7fd04df9b5155cad37526aa99686fd925056R20-R38

Comment on lines +20 to +33
//TODO(skaldarnar): I'm not fully settled on how to model the Platform. I thought splitting this up into two enums
// for OS and Architecture would help with more type-safe construction of these values, simplify comparison to
// select the right JRE for a game, etc.
//
// On the other hand, the set of supported platforms is so limited, and continuing on a non-supported platform
// does not make much sense. So, maybe it is better to have a rather restrictive and explicit enum in the form of
// WINDOWS_X64
// LINUX_X64
// I'm adding the architecture to this list, as I hope that we'll be able to support old Intel and new M1 Macs at
// some point in the future, adding the following to the list:
// MAC_X64
// MAC_AARCH64
// The biggest drawback of being super-strict here is that development on non-supported platforms becomes
// impossible where it was just "not ideal" before.

Choose a reason for hiding this comment

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

It think this should be as type-safe as possible. It shouldn't be possible to run the launcher on unsupported platforms unintentionally. Having seperate enums for OS and Architecture allows for greater flexibility in adding new platforms in the future and also makes it easier to significantly differentiate by OS alone where needed. You could also possibly make Platform itself an enum for further type safety.

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