Description
I might add one or another pull request at a later time which will sort out the folder names (retaining compatiblity, of course).
Standard path name proposal
Somethink like os-arch-bitness[-special]
could work nicely and is a bit more extensible.
Implementation details
A small singleton instance (using an enum since we are on Java 6 now) would suffice for the default mappings. The Map could hold something like this: Map<OsInfo, List> where the OsInfo is a simple POJO which holds the OS name, arch and bitness, and optionally a special
fragment (like fp on ARM). The value is a list of search paths. The enum instance would only hold the defaults, though.
Configuration options
- Users could supply additional paths via config file.
- Users could also supply additional search paths dynamically by providing a new OsInfo object and a List of path fragments.
- The new
Config
class would then load the defaults from the enum and add the additional entries.
Example entries for the defaults
- Windows 64 x86-64
- windows-amd64-64
- windows_64 (for compatiblity)
- Windows 32
- windows-x86-32
- windows_32 (for compatiblity)
- Linux 64 bit
- linux-amd64-64
- linux_64 (compat)
- Linux arm64
- linux-armv7l-64
etc.
Other advantages
We could replace the big and unmaintainable switch
statement with this lookup table. In fact, this is the main issue.
I might create a pull request in the future for this.