fix #3150: Win32 error in renderer process (#3214)

This commit is contained in:
Felix Häusler 2023-08-08 16:45:42 +02:00 committed by GitHub
parent 9c0238d7bb
commit b75895cdd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -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)
})
}
}

View File

@ -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',