From 5a881ec223ed4d48df126e36076be369dac0f173 Mon Sep 17 00:00:00 2001 From: Fangdun Tsai Date: Wed, 3 May 2023 11:00:09 +0800 Subject: [PATCH] fix(electron): ignore .DS_Store on MacOS (#2203) --- apps/electron/layers/main/src/data/workspace.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/electron/layers/main/src/data/workspace.ts b/apps/electron/layers/main/src/data/workspace.ts index 75a094db88..5fa2b17361 100644 --- a/apps/electron/layers/main/src/data/workspace.ts +++ b/apps/electron/layers/main/src/data/workspace.ts @@ -8,7 +8,11 @@ import type { AppContext } from '../context'; export async function listWorkspaces(context: AppContext) { const basePath = path.join(context.appDataPath, 'workspaces'); try { - return fs.readdir(basePath); + return fs + .readdir(basePath, { + withFileTypes: true, + }) + .then(dirs => dirs.filter(dir => dir.isDirectory()).map(dir => dir.name)); } catch (error) { logger.error('listWorkspaces', error); return [];