fix(electron): ignore .DS_Store on MacOS (#2203)

This commit is contained in:
Fangdun Tsai 2023-05-03 11:00:09 +08:00 committed by GitHub
parent 12b61d34c3
commit 5a881ec223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 [];