@@ -5,30 +5,33 @@ const log = require("electron-log")
55const Store = require ( "electron-store" )
66
77export const moveToApplicationsFolder = ( ) => {
8- if ( ! app . isInApplicationsFolder ( ) && ! isDev && ! userOptedOut ( ) ) {
9- dialog . showMessageBox ( {
10- type : "question" ,
11- buttons : [ "Move to Applications" , "Do Not Move" ] ,
12- message : "Move to Applications Folder?" ,
13- detail : "I can move myself to the Applications folder if you'd like. This will ensure that future updates will be installed correctly." ,
14- checkboxLabel : "Do not ask me again" ,
15- defaultId : 0
16- } , ( response , checkboxChecked ) => {
17- if ( response === 0 ) {
18- try {
19- if ( ! app . moveToApplicationsFolder ( ) ) {
20- throw new Error ( "Failed to move to Applications Folder." )
8+ // Check that we're on Mac OS
9+ if ( typeof ( app . isInApplicationsFolder ) === typeof ( Function ) ) {
10+ if ( ! app . isInApplicationsFolder ( ) && ! isDev && ! userOptedOut ( ) ) {
11+ dialog . showMessageBox ( {
12+ type : "question" ,
13+ buttons : [ "Move to Applications" , "Do Not Move" ] ,
14+ message : "Move to Applications Folder?" ,
15+ detail : "I can move myself to the Applications folder if you'd like. This will ensure that future updates will be installed correctly." ,
16+ checkboxLabel : "Do not ask me again" ,
17+ defaultId : 0
18+ } , ( response , checkboxChecked ) => {
19+ if ( response === 0 ) {
20+ try {
21+ if ( ! app . moveToApplicationsFolder ( ) ) {
22+ throw new Error ( "Failed to move to Applications Folder." )
23+ }
24+ } catch ( e ) {
25+ log . warn ( `Failed to move application to Applications Folder: ${ e } ` )
2126 }
22- } catch ( e ) {
23- log . warn ( `Failed to move application to Applications Folder: ${ e } ` )
2427 }
25- }
2628
27- if ( checkboxChecked ) {
28- // Don't remind user again
29- optOutReminder ( )
30- }
31- } )
29+ if ( checkboxChecked ) {
30+ // Don't remind user again
31+ optOutReminder ( )
32+ }
33+ } )
34+ }
3235 }
3336}
3437
0 commit comments