fix error while deleting a workspace

pull/3071/head
yann300 2 years ago committed by Aniket
parent b0ec19ccbc
commit 417bc7db61
  1. 5
      apps/remix-ide/src/app/files/fileProvider.js
  2. 8
      apps/remix-ide/src/app/plugins/parser/services/code-parser-imports.ts

@ -180,7 +180,7 @@ class FileProvider {
const stat = await window.remixFileSystem.stat(path)
try {
if (!stat.isDirectory()) {
return (this.removeFile(path))
return await this.removeFile(path)
} else {
const items = await window.remixFileSystem.readdir(path)
if (items.length !== 0) {
@ -196,8 +196,7 @@ class FileProvider {
} else {
// folder is empty
await window.remixFileSystem.rmdir(path)
}
this.event.emit('fileRemoved', this._normalizePath(path))
}
}
} catch (e) {
console.log(e)

@ -45,7 +45,13 @@ export default class CodeParserImports {
getDirectory = async (dir: string) => {
let result = []
const files = await this.plugin.call('fileManager', 'readdir', dir)
let files = {}
try {
if (await this.plugin.call('fileManager', 'exists', dir)) {
files = await this.plugin.call('fileManager', 'readdir', dir)
}
} catch (e) {}
const fileArray = this.normalize(files)
for (const fi of fileArray) {
if (fi) {

Loading…
Cancel
Save