From 2838abc0cd016188a9abdfe309ed94ff819649fc Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 15 Aug 2024 11:51:25 +0100 Subject: [PATCH] update implementation --- .../workspace/src/lib/actions/index.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index d767e8b025..e10fa20d43 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -674,8 +674,13 @@ export const moveFile = async (src: string, dest: string) => { if (src === dest) return // if you cut and paste to the same location then no need to move anything try { - const updatedDestPath = await fileManager.currentPath() - await fileManager.moveFile(src, updatedDestPath) + const isFile = await fileManager.isFile(dest) + if (isFile) { + const updatedDestPath = await fileManager.currentPath() + await fileManager.moveFile(src, updatedDestPath) + } else { + await fileManager.moveFile(src, dest) + } } catch (error) { dispatch(displayPopUp('Oops! An error occurred while performing moveFile operation.' + error)) } @@ -687,8 +692,13 @@ export const moveFolder = async (src: string, dest: string) => { if (src === dest) return // if you cut and paste to the same location then no need to move anything try { - const updatedDestPath = await fileManager.currentPath() - await fileManager.moveDir(src, updatedDestPath) + const isFile = await fileManager.isFile(dest) + if (!isFile) { + await fileManager.moveDir(src, dest) + } else { + const updatedDestPath = await fileManager.currentPath() + await fileManager.moveDir(src, updatedDestPath) + } } catch (error) { dispatch(displayPopUp('Oops! An error occurred while performing moveDir operation.' + error)) }