| 2 | import { isDev } from "../config" |
| 3 | |
| 4 | export const load = () => { |
| 5 | app.on("ready", () => { |
| 6 | if (process.platform !== "darwin" || isDev || app.isInApplicationsFolder() || process.env.OPENADE_SMOKE_TEST) { |
| 7 | return |
| 8 | } |
| 9 | const respId = dialog.showMessageBoxSync({ |
| 10 | type: "question", |
| 11 | buttons: ["Move to Applications", "Quit"], |
| 12 | defaultId: 0, |
| 13 | cancelId: 1, |
| 14 | title: "Move to Applications", |
| 15 | message: "OpenADE needs to run from the applications directory. Should we move it?", |
| 16 | }) |
| 17 | if (respId === 0) { |
| 18 | try { |
| 19 | app.moveToApplicationsFolder() |
| 20 | } catch (err) { |
| 21 | dialog.showMessageBox({ |
| 22 | type: "warning", |
| 23 | buttons: ["Okay"], |
| 24 | message: `There was problem moving to the Applications folder. Try quitting the application and moving it manually.`, |
| 25 | }) |
| 26 | } |
| 27 | } else { |
| 28 | app.quit() |
| 29 | } |
| 30 | }) |
| 31 | } |