From c8f4ecd9cbf41e722f8a071ace0cba486a28629d Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 2 Sep 2022 14:33:03 +0200 Subject: [PATCH 1/4] fix drag drop --- apps/remix-ide/src/app/files/fileManager.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) } } From e7f4bd29b3e11513d1e9d591534683b722e6c00f Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 2 Sep 2022 14:35:58 +0200 Subject: [PATCH 2/4] fix --- apps/remix-ide/src/app/files/fileManager.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index 9d45788cd0..6453fb58b2 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -875,12 +875,11 @@ class FileManager extends Plugin { 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) } } From 8c15f19daa66e7095de0b49a9fde3e9c567a8a10 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 2 Sep 2022 14:41:01 +0200 Subject: [PATCH 3/4] update EEXIST --- apps/remix-ide/src/app/files/fileManager.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index 6453fb58b2..c76cf34ff4 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -845,7 +845,7 @@ class FileManager extends Plugin { const fileName = helper.extractNameFromKey(src) if (await this.exists(dest + '/' + fileName)) { - throw createError({ code: 'ENOENT', message: `Cannot move ${src}. File already exists at destination ${dest}`}) + throw createError({ code: 'EEXIST', message: `Cannot move ${src}. File already exists at destination ${dest}`}) } await this.copyFile(src, dest, fileName) await this.remove(src) @@ -873,9 +873,9 @@ class FileManager extends Plugin { await this._handleIsDir(dest, `Cannot move content into ${dest}. Path is not directory.`) const dirName = helper.extractNameFromKey(src) if (await this.exists(dest + '/' + dirName) || src === dest) { - throw createError({ code: 'ENOENT', message: `Cannot move ${src}. Folder already exists at destination ${dest}`}) + throw createError({ code: 'EEXIST', message: `Cannot move ${src}. Folder already exists at destination ${dest}`}) } - + await this.copyDir(src, dest, dirName) await this.remove(src) From acd314aa60d520f86560a78ddde8e5a35e9db940 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 2 Sep 2022 14:41:31 +0200 Subject: [PATCH 4/4] rm space --- apps/remix-ide/src/app/files/fileManager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index c76cf34ff4..49135860bf 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -875,7 +875,6 @@ class FileManager extends Plugin { if (await this.exists(dest + '/' + dirName) || src === dest) { throw createError({ code: 'EEXIST', message: `Cannot move ${src}. Folder already exists at destination ${dest}`}) } - await this.copyDir(src, dest, dirName) await this.remove(src)