Skip to content
This repository was archived by the owner on Apr 18, 2022. It is now read-only.

Commit 7f1aece

Browse files
committed
Fixed Wininstaller
1 parent ee7baeb commit 7f1aece

File tree

15 files changed

+165
-55
lines changed

15 files changed

+165
-55
lines changed

.atomignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ builds
88
.gitattributes
99
*.bat
1010
PULL_REQUEST_TEMPLATE.md
11-
*.js
11+
#*.js
12+
!win32-ia32.js
13+
!win32-x64.js
1214
!gulpfile.js
1315
#plugins

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ minified
1111
no-comments
1212
*.7z
1313
package-lock.json
14+
builds/win32
15+
builds/linux

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,7 @@ MIT license, see [here](https://github.com/MinimineLP/mcscriptStudioCode/blob/ma
1313
* **Minimine** - *Initial work* - [Minimine](https://github.com/MinimineLP)
1414

1515
## Downloads
16-
- **Windows ia32: **
17-
[portable (.tar.gz)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/ia32/mcscriptStudioCode-win32-ia32-portable.tar.gz) |
18-
[portable (.zip)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/ia32/mcscriptStudioCode-win32-ia32-portable.zip) |
19-
[installer (.msi)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/ia32/mcscriptstudiocode-win32-ia32.msi) |
20-
[installer (.exe)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/ia32/mcscriptstudiocode-win32-ia32.exe)
21-
22-
- **Windows x64: **
23-
[portable (.tar.gz)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/x64/mcscriptStudioCode-win32-x64-portable.tar.gz) |
24-
[portable (.zip)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/x64/mcscriptStudioCode-win32-x64-portable.zip) |
25-
[installer (.msi)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/x64/mcscriptstudiocode-win32-x64.msi) |
26-
[installer (.exe)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/win32/x64/mcscriptstudiocode-win32-x64.exe)
27-
28-
- **Linux ia32: **
29-
[portable (.tar.gz)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/linux/ia32/mcscriptStudioCode-linux-ia32-portable.tar.gz) |
30-
[portable (.zip)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/linux/ia32/mcscriptStudioCode-linux-ia32-portable.zip)
31-
32-
- **Linux x64: **
33-
[portable (.tar.gz)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/linux/x64/mcscriptStudioCode-linux-x64-portable.tar.gz) |
34-
[portable (.zip)](https://raw.githubusercontent.com/MinimineLP/mcscriptStudioCode/master/builds/linux/x64/mcscriptStudioCode-linux-x64-portable.zip)
35-
16+
You find the downloads [here](https://github.com/MinimineLP/mcscriptStudioCode/releases/tag/0.0.3)
3617

3718
## Issues
3819
Please report bugs with the [issue function](https://github.com/MinimineLP/mcscriptStudioCode/issues).

app/main.js

Lines changed: 61 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/main.ts

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,86 @@
1-
// Modules to control application life and create native browser window
21
import { app, BrowserWindow, dialog, ipcMain, Menu, Event } from "electron";
32
import * as fs from "fs";
43
import MenuManager from "./src/scripts/MenuManager";
54

5+
// Modules to control application life and create native browser window
6+
if (require("electron-squirrel-startup") == true) {
7+
(() => {
8+
console.log(require("electron-squirrel-startup"));
9+
10+
// this should be placed at top of main.js to handle setup events quickly
11+
if (handleSquirrelEvent()) {
12+
// squirrel event handled and app will exit in 1000ms, so don't do anything else
13+
return;
14+
}
15+
16+
function handleSquirrelEvent() {
17+
if (process.argv.length === 1) {
18+
return false;
19+
}
20+
21+
const ChildProcess = require("child_process");
22+
const path = require("path");
23+
24+
const appFolder = path.resolve(process.execPath, "..");
25+
const rootAtomFolder = path.resolve(appFolder, "..");
26+
const updateDotExe = path.resolve(
27+
path.join(rootAtomFolder, "Update.exe")
28+
);
29+
const exeName = path.basename(process.execPath);
30+
31+
const spawn = function(command, args) {
32+
let spawnedProcess;
33+
34+
try {
35+
spawnedProcess = ChildProcess.spawn(command, args, {
36+
detached: true
37+
});
38+
} catch (error) {}
39+
40+
return spawnedProcess;
41+
};
42+
43+
const spawnUpdate = function(args) {
44+
return spawn(updateDotExe, args);
45+
};
46+
47+
const squirrelEvent = process.argv[1];
48+
switch (squirrelEvent) {
49+
case "--squirrel-install":
50+
case "--squirrel-updated":
51+
// Optionally do things such as:
52+
// - Add your .exe to the PATH
53+
// - Write to the registry for things like file associations and
54+
// explorer context menus
55+
56+
// Install desktop and start menu shortcuts
57+
spawnUpdate(["--createShortcut", exeName]);
58+
59+
setTimeout(app.quit, 1000);
60+
return true;
61+
62+
case "--squirrel-uninstall":
63+
// Undo anything you did in the --squirrel-install and
64+
// --squirrel-updated handlers
65+
66+
// Remove desktop and start menu shortcuts
67+
spawnUpdate(["--removeShortcut", exeName]);
68+
69+
setTimeout(app.quit, 1000);
70+
return true;
71+
72+
case "--squirrel-obsolete":
73+
// This is called on the outgoing version of your app before
74+
// we update to the new version - it's the opposite of
75+
// --squirrel-updated
76+
77+
app.quit();
78+
return true;
79+
}
80+
}
81+
})();
82+
}
83+
684
let menumanager = new MenuManager();
785
//menumanager.pushItem("File", {label:"Save",accelerator: 'CmdOrCtrl+S'},[0])
886
//menumanager.pushItem("File", {label:"Save as",accelerator: 'CmdOrCtrl+Shift+S'},[0])
@@ -12,7 +90,7 @@ let menumanager = new MenuManager();
1290
let icons = __dirname.replace(/\\/g, "/") + "/assets/icons/";
1391
let date: Date = new Date();
1492
if (date.getMonth() == 11) icons += "christmas/";
15-
let specialicondifficulty = 100;
93+
let specialicondifficulty = 10;
1694
let icon = icons + "icon.png";
1795
let appdata =
1896
process.env.APPDATA ||

app/package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"zip-folder": "^1.0.0"
1717
},
1818
"dependencies": {
19+
"electron-squirrel-startup": "^1.0.0",
1920
"extract-zip": "^1.6.7",
2021
"jquery": "^3.3.1",
2122
"js-yaml": "^3.12.0",

app/src/scripts/pluginmanager/PluginManager.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/scripts/pluginmanager/PluginManager.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)