fix(资产管理): 素材根目录不存在时仍列出账号库
生产只同步了账号库、没有搬素材时 data/accounts 不存在, list_accounts 提前 return [] 导致资产页一个账号都不显示。 根目录缺失按空目录处理,继续并入账号库;补回归用例。
This commit is contained in:
@@ -131,10 +131,12 @@ def list_accounts(prof=None):
|
||||
try:
|
||||
names = sorted(os.listdir(root))
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
# 素材根目录还不存在(例如生产只同步了账号库、没搬素材)——
|
||||
# 账号库仍要能列出来,不能在这里提前返回。
|
||||
names = []
|
||||
except Exception as e:
|
||||
_log.warning("列账号目录失败(%s): %s", root, e)
|
||||
return []
|
||||
names = []
|
||||
exts = _media_exts(prof)
|
||||
with _ctx():
|
||||
# **账号来源 = 素材目录 ∪ 账号库**:账号库里登记了但还没建文件夹的号也要看得见
|
||||
|
||||
Reference in New Issue
Block a user