fix: should not show open folder if it is not moved (#2299)

This commit is contained in:
Peng Xiao
2023-05-11 13:36:22 +08:00
committed by GitHub
parent 73dbb39009
commit 06fa0cdb60
12 changed files with 170 additions and 51 deletions

View File

@@ -6,6 +6,7 @@ import fs from 'fs-extra';
import * as Y from 'yjs';
import type { AppContext } from '../../context';
import { dbSubjects } from '../../events/db';
import { logger } from '../../logger';
import { ts } from '../../utils';
@@ -62,6 +63,18 @@ export class WorkspaceSQLiteDB {
this.db.close();
}
fs.realpath(this.path)
.then(realPath => {
dbSubjects.dbFilePathChange.next({
workspaceId: this.workspaceId,
path: this.path,
realPath,
});
})
.catch(() => {
// skip error
});
// use cached version?
const db = (this.db = sqlite(this.path));
db.exec(schemas.join(';'));