Skip to content

Commit 8c34a31

Browse files
authored
Fix: Move to trash not working in Windows
1 parent 7a9583e commit 8c34a31

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1010

1111
- Error saving images with dialog [`f2445de`](https://github.com/ollm/OpenComic/commit/f2445de4af8e515fe9dda2ed7dc71e3213922b8e)
1212
- Drag and Drop not working due an Electron breaking change [`a830bf8`](https://github.com/ollm/OpenComic/commit/a830bf8a11f62eb9daeafcf56fd59e0489ce42d0)
13+
- Move to trash not working in Windows
1314

1415
## [v1.4.0](https://github.com/ollm/OpenComic/releases/tag/v1.4.0) (26-01-2025)
1516

scripts/dom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,7 @@ function removeComic(path, confirm = false, reload = true)
22962296
async function moveToTrash(path, fromIndexNotMasterFolders = false, confirm = false)
22972297
{
22982298
await dom.poster.findAndDelete(path, true, true);
2299-
await electron.shell.trashItem(path);
2299+
await electron.ipcRenderer.invoke('move-to-trash', path);
23002300

23012301
if(fromIndexNotMasterFolders)
23022302
dom.removeComic(path, true, false);

scripts/main.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function createWindow() {
133133

134134
let windowShowed = false;
135135

136-
let showTimeout = setTimeout(function(){
136+
let showTimeout = setTimeout(function() {
137137

138138
win.show();
139139
windowShowed = true;
@@ -201,14 +201,20 @@ app.on('activate', () => {
201201
}
202202
})
203203

204-
ipcMain.on('open-at-login', function(event, active = false){
204+
ipcMain.on('open-at-login', function(event, active = false) {
205205

206206
app.setLoginItemSettings({
207207
openAtLogin: active,
208208
})
209209

210210
});
211211

212+
ipcMain.handle('move-to-trash', function(event, path) {
213+
214+
return shell.trashItem(path);
215+
216+
});
217+
212218
// In this file you can include the rest of your app's specific main process
213219
// code. You can also put them in separate files and require them here.
214220

0 commit comments

Comments
 (0)