AppFS

Not one, but 6 filesystems that map to locations your OS recommends for application data.

Each platform -- Linux, MacOS, Windows etc -- has a number of pre-defined locations where applications may store data. It is important that your application is aware of this, and essential if your code is to be cross-platform.

You can abstract these details away with the following 6 filesystems:

  • SiteDataFS
  • SiteConfigFS
  • UserDataFS
  • UserCacheFS
  • UserConfigFS
  • UserLogFS

When you construct these filesystems you supply the application name, author, and version. The constructor will select the root path appropriate for the type of data you wish to store. Here's an example of how you might use it:

from fs.appfs import UserConfigFS
user_data = UserConfigFS('myapplication', 'willmcgugan', '1.0')
with user_data.open('settings.ini') as ini_file:
    initialize_app(ini_file)

Note that under the hood the implementation for these filesystems is identical to OSFS , and there is no performance penalty in using them.

See App Filesystem docs for more details.

Author
Will McGugan
Published
Aug 18, 2017
Revision
2