feat: 配置项目的热修改

This commit is contained in:
2024-03-30 19:24:09 +08:00
parent c15c604752
commit 9b2b0a7c7d
15 changed files with 11526 additions and 47 deletions

View File

@ -43,12 +43,13 @@ def load_resource_from_dir(path: str):
_loaded_resource_packs.append(ResourceMetadata(**metadata))
def get(path: str, default: Any = None) -> str | Any:
def get_path(path: str, abs_path: bool = False, default: Any = None) -> str | Any:
"""
获取资源包中的文件
Args:
abs_path:
default: 默认
path: 文件相对路径
Returns: 文件绝对路径
"""
return _resource_data.get(path, default)
return _resource_data.get(path, default) if not abs_path else os.path.abspath(_resource_data.get(path, default))