diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index 32892f9136..9d45788cd0 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -872,14 +872,15 @@ class FileManager extends Plugin { await this._handleIsDir(src, `Cannot move ${src}. Path is not directory.`) await this._handleIsDir(dest, `Cannot move content into ${dest}. Path is not directory.`) const dirName = helper.extractNameFromKey(src) - - if (await this.exists(dest + '/' + dirName)) { + if (await this.exists(dest + '/' + dirName) || src === dest) { throw createError({ code: 'ENOENT', message: `Cannot move ${src}. Folder already exists at destination ${dest}`}) } + console.log('mv files') await this.copyDir(src, dest, dirName) await this.remove(src) } catch (e) { + console.log('mv dir error', e) throw new Error(e) } }