Skip to content
This repository was archived by the owner on Jul 14, 2023. It is now read-only.

Commit 27d708e

Browse files
authored
Merge pull request #123 from education/fix-lets-move-windows-bug
Fix Electron LetsMove Bug on Windows
2 parents 7ae665d + e8bc7a0 commit 27d708e

1 file changed

Lines changed: 24 additions & 21 deletions

File tree

app/main-process/letsMove.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,33 @@ const log = require("electron-log")
55
const Store = require("electron-store")
66

77
export 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

Comments
 (0)