From 22d8049c2ca8356f8c706f08fd94b78b436f0471 Mon Sep 17 00:00:00 2001 From: hicccc77 <98377878+hicccc77@users.noreply.github.com> Date: Sat, 28 Mar 2026 17:30:56 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix:=20=E5=85=BC=E5=AE=B9=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=96=B0=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84=E5=A4=9A?= =?UTF-8?q?=E4=B8=80=E5=B1=82=E5=B5=8C=E5=A5=97=E5=AF=BC=E8=87=B4=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=9B=AE=E5=BD=95=E8=AF=86=E5=88=AB=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5f6b0e8960acb1acf134f47076f2619ed7ad7196. --- electron/services/dbPathService.ts | 55 +++++++----------------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/electron/services/dbPathService.ts b/electron/services/dbPathService.ts index 6a72257..592c9f9 100644 --- a/electron/services/dbPathService.ts +++ b/electron/services/dbPathService.ts @@ -218,34 +218,22 @@ export class DbPathService { scanWxidCandidates(rootPath: string): WxidInfo[] { const wxids: WxidInfo[] = [] - const scanOneLevelForCandidates = (scanPath: string) => { - if (!existsSync(scanPath)) return - const entries = readdirSync(scanPath) - for (const entry of entries) { - const entryPath = join(scanPath, entry) - let stat: ReturnType - try { stat = statSync(entryPath) } catch { continue } - if (!stat.isDirectory()) continue - const lower = entry.toLowerCase() - if (lower === 'all_users') continue - if (!entry.includes('_')) continue - wxids.push({ wxid: entry, modifiedTime: stat.mtimeMs }) - } - } - try { - scanOneLevelForCandidates(rootPath) - - // 兜底:往下再找一层(兼容 2.0b4.0.9/xwechat_files/wxid_xxx 结构) - if (wxids.length === 0 && existsSync(rootPath)) { - const subDirs = readdirSync(rootPath) - for (const sub of subDirs) { - const subPath = join(rootPath, sub) - try { if (!statSync(subPath).isDirectory()) continue } catch { continue } - scanOneLevelForCandidates(subPath) + if (existsSync(rootPath)) { + const entries = readdirSync(rootPath) + for (const entry of entries) { + const entryPath = join(rootPath, entry) + let stat: ReturnType + try { stat = statSync(entryPath) } catch { continue } + if (!stat.isDirectory()) continue + const lower = entry.toLowerCase() + if (lower === 'all_users') continue + if (!entry.includes('_')) continue + wxids.push({ wxid: entry, modifiedTime: stat.mtimeMs }) } } + if (wxids.length === 0) { const rootName = basename(rootPath) if (rootName.includes('_') && rootName.toLowerCase() !== 'all_users') { @@ -294,25 +282,6 @@ export class DbPathService { const modifiedTime = this.getAccountModifiedTime(fullPath) wxids.push({ wxid: account, modifiedTime }) } - - // 兜底:如果一层找不到,尝试往下再找一层子目录(兼容 2.0b4.0.9/xwechat_files/wxid_xxx 结构) - if (wxids.length === 0) { - try { - const subDirs = readdirSync(rootPath) - for (const sub of subDirs) { - const subPath = join(rootPath, sub) - try { - if (!statSync(subPath).isDirectory()) continue - } catch { continue } - const subAccounts = this.findAccountDirs(subPath) - for (const account of subAccounts) { - const fullPath = join(subPath, account) - const modifiedTime = this.getAccountModifiedTime(fullPath) - wxids.push({ wxid: account, modifiedTime }) - } - } - } catch { } - } } catch { } const sorted = wxids.sort((a, b) => {