Skip to content

Commit e35c753

Browse files
Remove atom.trashItem and atom.showItemInFolder
…since they weren't even being used. The equivalent functions from the `shell` module of `@electron/remote` have been performing the same task in PulsarNext for a while now.
1 parent d206f14 commit e35c753

File tree

3 files changed

+0
-81
lines changed

3 files changed

+0
-81
lines changed

src/application-delegate.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -132,32 +132,6 @@ module.exports = class ApplicationDelegate {
132132
return ipcHelpers.on(ipcRenderer, 'did-leave-full-screen', callback);
133133
}
134134

135-
trashItem(filePath) {
136-
// A simple wrapper around `shell.trashItem`, which currently can only be
137-
// called from the main process on Windows.
138-
return ipcRenderer.invoke('trashItem', filePath).then(({ outcome, error, result }) => {
139-
if (outcome === 'success') {
140-
// `result` is undefined, but we might as well guard against an
141-
// Electron API change in the future.
142-
return result;
143-
} else if (outcome === 'failure') {
144-
return Promise.reject(error);
145-
}
146-
});
147-
}
148-
149-
showItemInFolder(filePath) {
150-
// A simple wrapper around `shell.trashItem`, which currently can only be
151-
// called from the main process.
152-
return ipcRenderer.invoke('showItemInFolder', filePath).then(({ outcome, error, result }) => {
153-
if (outcome === 'success') {
154-
return result;
155-
} else if (outcome === 'failure') {
156-
return Promise.reject(error);
157-
}
158-
});
159-
}
160-
161135
async openWindowDevTools() {
162136
// Defer DevTools interaction to the next tick, because using them during
163137
// event handling causes some wrong input events to be triggered on

src/atom-environment.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -796,26 +796,6 @@ class AtomEnvironment {
796796
return this.setFullScreen(!this.isFullScreen());
797797
}
798798

799-
// A proxy to `shell.trashItem` — which ought to work in the renderer, but
800-
// suffers from a bug on Windows. We work around it by delegating to the main
801-
// process.
802-
//
803-
// Undocumented for now, but may eventually be an official part of the API
804-
// for when community packages need to delete files.
805-
trashItem(filePath) {
806-
return this.applicationDelegate.trashItem(filePath);
807-
}
808-
809-
// A proxy to `shell.showItemInFolder` — which ought to work in the renderer,
810-
// but seems to suffer from a bug on macOS. We work around it by delegating
811-
// to the main process.
812-
//
813-
// Undocumented for now, but may eventually be an official part of the API
814-
// for when community packages need to perform this function.
815-
showItemInFolder(filePath) {
816-
return this.applicationDelegate.showItemInFolder(filePath);
817-
}
818-
819799
// Restore the window to its previous dimensions and show it.
820800
//
821801
// Restores the full screen and maximized state after the window has resized to

src/main-process/atom-application.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -136,41 +136,6 @@ ipcMain.handle('setAsDefaultProtocolClient', (_, { protocol, path, args }) => {
136136
return app.setAsDefaultProtocolClient(protocol, path, args);
137137
});
138138

139-
// Handle file deletion requests.
140-
//
141-
// Works around https://github.com/electron/electron/issues/29598, which seems
142-
// to be the cause of failed deletion attempts on Windows.
143-
ipcMain.handle('trashItem', async (_, filePath) => {
144-
// We can't toss a promise over the wall, so we'll `await` it on our side and
145-
// report the progress back to the renderer.
146-
//
147-
// If we return an `Error` object from this handler in the case of error,
148-
// `ipcRenderer.invoke` will detect it and wrap it with its own explanation.
149-
// We want to preserve the original error and hide the implementation
150-
// details, so we instead return an object with an explicit `outcome`
151-
// property to avoid this behavior.
152-
try {
153-
// `shell.trashItem` resolves with an empty value on success…
154-
let result = await shell.trashItem(filePath);
155-
return { outcome: 'success', result };
156-
} catch (error) {
157-
// …and rejects on failure.
158-
return { outcome: 'failure', error };
159-
}
160-
});
161-
162-
ipcMain.handle('showItemInFolder', async (_, filePath) => {
163-
try {
164-
// Result will be `undefined`, but might as well return it in case of a
165-
// future Electron API change.
166-
let result = shell.showItemInFolder(filePath);
167-
return { outcome: 'success', result };
168-
} catch (error) {
169-
// Not sure whether this can even fail, but might as well handle it.
170-
return { outcome: 'failure', error };
171-
}
172-
})
173-
174139
// The application's singleton class.
175140
//
176141
// It's the entry point into the Pulsar application and maintains the global state

0 commit comments

Comments
 (0)