✨ feat(submodule): 添加子模块管理功能,支持子模块的初始化、更新和信息获取
Sequential Lint and Type Check / ruff-call (push) Waiting to run
Sequential Lint and Type Check / pyright-call (push) Blocked by required conditions

This commit is contained in:
HibiKier
2025-08-03 23:57:13 +08:00
parent 6d829bcb02
commit a3142ad065
7 changed files with 1538 additions and 9 deletions
+9 -9
View File
@@ -34,13 +34,13 @@ class ResourceManager:
):
if (FONT_PATH.exists() and os.listdir(FONT_PATH)) and not force:
return
if cls.TMP_PATH.exists():
logger.debug(
"resources临时文件夹已存在,移除resources临时文件夹", LOG_COMMAND
)
await clean_git(cls.TMP_PATH)
shutil.rmtree(cls.TMP_PATH, ignore_errors=True)
if is_zip:
if cls.TMP_PATH.exists():
logger.debug(
"resources临时文件夹已存在,移除resources临时文件夹", LOG_COMMAND
)
await clean_git(cls.TMP_PATH)
shutil.rmtree(cls.TMP_PATH, ignore_errors=True)
cls.TMP_PATH.mkdir(parents=True, exist_ok=True)
try:
await cls.__download_resources()
@@ -49,9 +49,9 @@ class ResourceManager:
logger.error("获取resources资源包失败", LOG_COMMAND, e=e)
else:
if git_source == "ali":
await AliyunRepoManager.update(cls.GITHUB_URL, cls.TMP_PATH)
await AliyunRepoManager.update(cls.GITHUB_URL, cls.RESOURCE_PATH)
else:
await GithubRepoManager.update(cls.GITHUB_URL, cls.TMP_PATH)
await GithubRepoManager.update(cls.GITHUB_URL, cls.RESOURCE_PATH)
cls.UNZIP_PATH = cls.TMP_PATH / "resources"
cls.file_handle()
if cls.TMP_PATH.exists():
@@ -63,7 +63,7 @@ class ResourceManager:
def file_handle(cls):
if not cls.UNZIP_PATH:
return
cls.__recursive_folder(cls.UNZIP_PATH, "resources")
cls.__recursive_folder(cls.UNZIP_PATH, ".")
@classmethod
def __recursive_folder(cls, dir: Path, parent_path: str):