Fix: 修复Python Online板卡下「本地文件系统」连续多次读取目录时报错

This commit is contained in:
王立帮
2024-11-27 14:22:02 +08:00
parent e0534d607d
commit 624012e96f
7 changed files with 542 additions and 90 deletions

View File

@@ -108,16 +108,17 @@ export default class StatusBarFileSystem extends PageBase {
const filePath = selected[0].id;
this.#fileTree_.showProgress();
const fs = this.#fileTree_.getFS();
const [error, result] = await fs.readFile(filePath);
if (error) {
this.hideEditor();
this.#fileTree_.deselectAll();
} else {
try {
const result = await fs.readFile(filePath);
this.showEditor();
this.#editor_.setValue(result);
this.#editor_.scrollToTop();
this.#editor_.focus();
this.setStatus(false);
} catch (error) {
Debug.error(error);
this.hideEditor();
this.#fileTree_.deselectAll();
}
this.#fileTree_.hideProgress();
});