mirror of
https://github.com/OpenFusionProject/Client.git
synced 2024-11-22 13:40:06 +00:00
Install Unity Web Player through Electron rather than the bat file
This method is a lot more reliable, as the bat file was known to not work in certain configurations of Windows and on Wine
This commit is contained in:
parent
c1db7bc047
commit
3d9107a7f1
@ -1,5 +0,0 @@
|
|||||||
PUSHD %~dp0
|
|
||||||
.\UnityWebPlayer.exe /quiet /S
|
|
||||||
robocopy WebPlayer "%USERPROFILE%\AppData\LocalLow\Unity\WebPlayer" /s /e
|
|
||||||
del "%USERPROFILE%\AppData\LocalLow\Unity\WebPlayer\UnityBugReporter.exe"
|
|
||||||
POPD
|
|
40
index.js
40
index.js
@ -9,6 +9,38 @@ var mainWindow = null;
|
|||||||
|
|
||||||
app.commandLine.appendSwitch("--enable-npapi");
|
app.commandLine.appendSwitch("--enable-npapi");
|
||||||
|
|
||||||
|
function verifyUnity() {
|
||||||
|
console.log("Unimplemented!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function installUnity(callback) {
|
||||||
|
var utilsdir = __dirname + "\\..\\..\\utils";
|
||||||
|
|
||||||
|
// if running in non-packaged / development mode, this dir will be slightly different
|
||||||
|
if (process.env.npm_node_execpath) {
|
||||||
|
utilsdir = app.getAppPath() + "\\build\\utils";
|
||||||
|
}
|
||||||
|
|
||||||
|
// run the installer silently
|
||||||
|
var child = require("child_process").spawn(
|
||||||
|
utilsdir + "\\UnityWebPlayer.exe",
|
||||||
|
["/quiet", "/S"]
|
||||||
|
);
|
||||||
|
child.on("exit", function () {
|
||||||
|
// overwrite 3.5.2 loader/player with FF's custom version
|
||||||
|
var dstfolder =
|
||||||
|
process.env.USERPROFILE + "\\AppData\\LocalLow\\Unity\\WebPlayer";
|
||||||
|
fs.copySync(utilsdir + "\\WebPlayer", dstfolder, {
|
||||||
|
clobber: true,
|
||||||
|
});
|
||||||
|
// avoids error reporter popping up when closing Electron
|
||||||
|
fs.removeSync(dstfolder + "\\UnityBugReporter.exe");
|
||||||
|
console.log("Unity Web Player installed successfully.");
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initialSetup(firstTime) {
|
function initialSetup(firstTime) {
|
||||||
// Display a small window to inform the user that the app is working
|
// Display a small window to inform the user that the app is working
|
||||||
setupWindow = new BrowserWindow({
|
setupWindow = new BrowserWindow({
|
||||||
@ -19,13 +51,7 @@ function initialSetup(firstTime) {
|
|||||||
frame: false,
|
frame: false,
|
||||||
});
|
});
|
||||||
setupWindow.loadUrl("file://" + __dirname + "/initialsetup.html");
|
setupWindow.loadUrl("file://" + __dirname + "/initialsetup.html");
|
||||||
// Exec installUnity.bat and wait for it to finish.
|
installUnity(function () {
|
||||||
var child = require("child_process").spawn("cmd.exe", [
|
|
||||||
"/c",
|
|
||||||
"utils\\installUnity.bat",
|
|
||||||
]);
|
|
||||||
child.on("exit", function () {
|
|
||||||
console.log("Unity installed.");
|
|
||||||
if (!firstTime) {
|
if (!firstTime) {
|
||||||
// migration from pre-1.4
|
// migration from pre-1.4
|
||||||
// Back everything up, just in case
|
// Back everything up, just in case
|
||||||
|
Loading…
Reference in New Issue
Block a user