Use a ResourceManager to find assets
This commit is contained in:
13
squirrelbattle/resources.py
Normal file
13
squirrelbattle/resources.py
Normal file
@ -0,0 +1,13 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class ResourceManager:
|
||||
"""
|
||||
The ResourceManager loads resources at their right place,
|
||||
and stores files in config directory.
|
||||
"""
|
||||
BASE_DIR = Path(__file__).resolve().parent / 'assets'
|
||||
|
||||
@classmethod
|
||||
def get_asset_path(cls, filename: str) -> str:
|
||||
return str(cls.BASE_DIR / filename)
|
Reference in New Issue
Block a user