Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import os
  2. import pathlib
  3.  
  4.  
  5. class Paths:
  6. _data = dict()
  7.  
  8. def __init__(self):
  9. self.root = pathlib.Path(os.path.realpath(__file__)).parent.parent
  10. self.home = os.path.dirname(
  11. os.path.dirname(os.path.realpath(__file__)))
  12. for file in self.root.rglob('*'):
  13. if file.is_dir() and file.name != "__pycache__":
  14. setattr(self, file.name, str(file))
  15. self._data[file.name] = str(file)
  16. self.add_hidden()
  17.  
  18. def add_hidden(self):
  19. data_dir = str(self.root.parent / ".data")
  20. config_files_dir = str(self.root.parent / ".data/.config_files")
  21. self.data = data_dir
  22. self._data['data'] = data_dir
  23. self.config_files = config_files_dir
  24. self._data['config_files'] = config_files_dir
  25.  
  26. def __getitem__(self, item):
  27. return self._data[item]
  28.  
  29.  
  30. PATHS = Paths()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement