From b75895cdd1a51638f2e67b222b266ff8b9cb9d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=A4usler?= Date: Tue, 8 Aug 2023 16:45:42 +0200 Subject: [PATCH] fix #3150: Win32 error in renderer process (#3214) --- src/main/app/index.js | 6 +++++- src/renderer/store/project.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/app/index.js b/src/main/app/index.js index 8581ac8c..3424b6a2 100644 --- a/src/main/app/index.js +++ b/src/main/app/index.js @@ -3,7 +3,7 @@ import fsPromises from 'fs/promises' import { exec } from 'child_process' import dayjs from 'dayjs' import log from 'electron-log' -import { app, BrowserWindow, clipboard, dialog, ipcMain, nativeTheme } from 'electron' +import { app, BrowserWindow, clipboard, dialog, ipcMain, nativeTheme, shell } from 'electron' import { isChildOfDirectory } from 'common/filesystem/paths' import { isLinux, isOsx, isWindows } from '../config' import parseArgs from '../cli/parser' @@ -576,6 +576,10 @@ class App { const { keybindings } = this._accessor return keybindings.setUserKeybindings(userKeybindings) }) + + ipcMain.handle('mt::fs-trash-item', async (event, fullPath) => { + return shell.trashItem(fullPath) + }) } } diff --git a/src/renderer/store/project.js b/src/renderer/store/project.js index 6cc70f85..bdafae74 100644 --- a/src/renderer/store/project.js +++ b/src/renderer/store/project.js @@ -140,7 +140,7 @@ const actions = { }) bus.$on('SIDEBAR::remove', () => { const { pathname } = state.activeItem - shell.trashItem(pathname).catch(err => { + ipcRenderer.invoke('mt::fs-trash-item', pathname).catch(err => { notice.notify({ title: 'Error while deleting', type: 'error',