mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-19 14:10:18 +00:00
17 lines
475 B
Python
17 lines
475 B
Python
import importlib.resources
|
|
import sys
|
|
|
|
|
|
def get_resource(path: str):
|
|
"""
|
|
A wrapper for `importlib.resources.files()` since it's not available in Python 3.8.
|
|
"""
|
|
if sys.version_info >= (3, 9, 0):
|
|
with importlib.resources.as_file(
|
|
importlib.resources.files(__name__).joinpath(path)
|
|
) as resource_path:
|
|
return resource_path
|
|
|
|
with importlib.resources.path(__name__, path) as resource_path:
|
|
return resource_path
|