Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
fix: 修复链接仓库状态特殊时的异常情况
Browse files Browse the repository at this point in the history
  • Loading branch information
WankkoRee committed May 29, 2023
1 parent 5e43a53 commit c611e69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion eaio/entry/gui/tab_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def create(self):
self.gTree.tag_configure(RepoChildStatus.Modified.value, background='#ffe3e3')
self.gTree.tag_configure(RepoStatus.DownloadFailed.value, background='#f1f3f5')
self.gTree.tag_configure(RepoStatus.NotDownload.value, background='#c5f6fa')
self.gTree.tag_configure(RepoRootStatus.NotExist.value, background='#c5f6fa')
self.gTree.tag_configure(RepoRootStatus.NotDir.value, background='#f1f3f5')
self.gTree.bind('<ButtonRelease-3>', self.event)
self.gTree.grid(row=0, column=0, sticky=tk.NSEW)

Expand Down Expand Up @@ -168,7 +170,7 @@ def scan_repo(self):
if hide_downloaded and repo_status == RepoChildStatus.Downloaded:
continue
is_root = path.parent == to_drive(path.drive)
is_dir = repo_status == RepoChildStatus.IsDir or path.is_dir()
is_dir = depth == 0 or depth == 1 or repo_status == RepoChildStatus.IsDir or path.is_dir()
iid = str(path.absolute())
self.gTree.insert('' if is_root else str(path.parent.absolute()), 'end', values=(' ' * depth + (str(path) if is_root else path.name), '' if is_dir or repo_status == RepoChildStatus.Deleted else str_size(path.stat().st_size), repo_status.value), iid=iid, open=True, tags=repo_status.value)
self.vTree[iid] = (path, depth, repo_status)
Expand Down
7 changes: 6 additions & 1 deletion eaio/function/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ def download_electron(drive: Path, version: str, arch: str, proxy: str | None =
repo.unlink()
if not repo.exists():
logger.warning(f"{repo} 不存在, 自动创建")
repo.mkdir(parents=True)
try:
repo.mkdir(parents=True)
except FileExistsError as e:
msg = "无法创建链接仓库,可能是链接仓库根目录不是目录,为防止误删,请自行检查并删除"
logger.warning(msg)
raise DownloadError(msg)

logger.debug("正在下载 Electron 预编译程序")
logger.debug(f"目标链接仓库: {repo}")
Expand Down

0 comments on commit c611e69

Please sign in to comment.