data.py 506 B

1234567891011121314151617181920212223242526
  1. '''
  2. Application Data functions
  3. '''
  4. import os
  5. __APPFOLDER = os.path.expandvars(r'%LOCALAPPDATA%\Merelec\Simsdt')
  6. __CACHE = f'{__APPFOLDER}\cache'
  7. __DATA = f'{__APPFOLDER}\data'
  8. __CONFIG = f'{__APPFOLDER}\config'
  9. APPDIRS = {
  10. 'APPFOLDER': __APPFOLDER,
  11. 'CACHE': __CACHE,
  12. 'DATA': __DATA,
  13. 'CONFIG': __CONFIG
  14. }
  15. def check_appdata_folders():
  16. [create_dir(v) for (k, v) in APPDIRS.items()]
  17. def create_dir(directory):
  18. if not os.path.exists(directory):
  19. os.makedirs(directory)