ponylang / appdirs

Library for getting platform-specific application directories e.g. directory for user-based config :horse: :file_folder:
https://ponylang.io
BSD 2-Clause "Simplified" License
8 stars 3 forks source link

Refactor platform detection internals #16

Open mfelsche opened 4 years ago

mfelsche commented 4 years ago

With merging of #15 we now have a mixture of ifdef and if (in case of osx) for detecting how to generate application directories.

It might be cleaner to use a primitive like:


primitive Osx
primitive OsxAsUnix
primitive Unix
primitive Windows

type Platform is (Osx | OsxAsUnix | Unix | Windows)

and use a match statement in each function to determine how to create the particular appdirs.

cc @SeanTAllen does that express your ideas?

SeanTAllen commented 4 years ago

@mfelsche yes.

a key point being that we determine the platform once on startup and then use that platform type with matching everywhere else.