diff --git a/src/components/Explorer/FileExplorer.tsx b/src/components/Explorer/FileExplorer.tsx index 049777a56..6c4a874eb 100644 --- a/src/components/Explorer/FileExplorer.tsx +++ b/src/components/Explorer/FileExplorer.tsx @@ -105,16 +105,10 @@ function FileExplorerRowContextMenu({ menuTargetElement={itemRef} callback={callback} items={[ - + Rename , - + Delete , { - systemIOActor.send({type: SystemIOMachineEvents.deleteFileOrFolder, data: { - requestedPath: child.path - }}) + systemIOActor.send({ + type: SystemIOMachineEvents.deleteFileOrFolder, + data: { + requestedPath: child.path, + }, + }) }, rowRenameStart: () => { setIsRenaming(true) diff --git a/src/machines/systemIO/systemIOMachine.ts b/src/machines/systemIO/systemIOMachine.ts index 2ae316901..a21c9a294 100644 --- a/src/machines/systemIO/systemIOMachine.ts +++ b/src/machines/systemIO/systemIOMachine.ts @@ -156,7 +156,7 @@ export const systemIOMachine = setup({ fileNameWithExtension: string absolutePathToParentDirectory: string } - } + } | { type: SystemIOMachineEvents.deleteFileOrFolder data: { @@ -880,10 +880,10 @@ export const systemIOMachine = setup({ return { context, requestedFileNameWithExtension: - event.data.requestedFileNameWithExtension, + event.data.requestedFileNameWithExtension, fileNameWithExtension: event.data.fileNameWithExtension, absolutePathToParentDirectory: - event.data.absolutePathToParentDirectory, + event.data.absolutePathToParentDirectory, rootContext: self.system.get('root').getSnapshot().context, } }, diff --git a/src/machines/systemIO/systemIOMachineDesktop.ts b/src/machines/systemIO/systemIOMachineDesktop.ts index 746ad4b8b..470c96d2e 100644 --- a/src/machines/systemIO/systemIOMachineDesktop.ts +++ b/src/machines/systemIO/systemIOMachineDesktop.ts @@ -518,10 +518,10 @@ export const systemIOMachineDesktop = systemIOMachine.provide({ requestedPath: string } }) => { - await window.electron.rm(input.requestedPath) + await window.electron.rm(input.requestedPath, {recursive:true}) return { message: 'File deleted successfully', - requestedPath: input.requestedPath + requestedPath: input.requestedPath, } } ), diff --git a/src/machines/systemIO/utils.ts b/src/machines/systemIO/utils.ts index f1dbdc035..f69cd7a31 100644 --- a/src/machines/systemIO/utils.ts +++ b/src/machines/systemIO/utils.ts @@ -18,7 +18,7 @@ export enum SystemIOMachineActors { bulkCreateKCLFilesAndNavigateToFile = 'bulk create kcl files and navigate to file', renameFolder = 'renameFolder', renameFile = 'renameFile', - deleteFileOrFolder = 'deleteFileOrFolder' + deleteFileOrFolder = 'deleteFileOrFolder', } export enum SystemIOMachineStates { @@ -38,7 +38,7 @@ export enum SystemIOMachineStates { bulkCreatingKCLFilesAndNavigateToFile = 'bulkCreatingKCLFilesAndNavigateToFile', renamingFolder = 'renamingFolder', renamingFile = 'renamingFile', - deletingFileOrFolder = 'deletingFileOrFolder' + deletingFileOrFolder = 'deletingFileOrFolder', } const donePrefix = 'xstate.done.actor.' @@ -69,7 +69,7 @@ export enum SystemIOMachineEvents { 'bulk create kcl files and navigate to file', renameFolder = 'rename folder', renameFile = 'rename file', - deleteFileOrFolder = 'delete file or folder' + deleteFileOrFolder = 'delete file or folder', } export enum SystemIOMachineActions {