From f9171366c92effb008c688646e454e9cbd0223fd Mon Sep 17 00:00:00 2001 From: solvedDev <33347616+solvedDev@users.noreply.github.com> Date: Fri, 5 Apr 2019 22:08:34 +0200 Subject: [PATCH] v0.11.3 - you can now drag files into bridge. to open them - you can now properly open files with bridge - fixed plugin installation - spawn_entity + rideable is now a warning instead of an error - button to toggle chrome dev tools in production --- package.json | 4 +- src/index.ejs | 4 +- src/main/communicator.js | 10 +++- src/main/index.js | 38 ++++++++++++--- .../components/plugin_install/CloudPlugin.vue | 4 +- src/renderer/scripts/FileSystem.js | 48 +++++++++++++++---- src/renderer/scripts/constants/app_version.js | 2 +- src/renderer/store/modules/Plugins.js | 7 +-- src/renderer/windows/Settings.js | 10 +++- static/auto_completions/_RP/entity/main.json | 26 ++++++++++ static/data/problems.json | 1 + 11 files changed, 123 insertions(+), 31 deletions(-) create mode 100644 static/auto_completions/_RP/entity/main.json diff --git a/package.json b/package.json index 67cb20066..e6dd69b68 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bridge", "productName": "bridge.", - "version": "0.11.2", + "version": "0.11.3", "author": "solvedDev <33347616+solvedDev@users.noreply.github.com>", "description": "A powerful add-on editor", "license": null, @@ -19,7 +19,7 @@ "postinstall": "" }, "build": { - "productName": "bridge", + "productName": "bridge.", "appId": "solved.editor.bridge", "directories": { "output": "build" diff --git a/src/index.ejs b/src/index.ejs index c4f424748..c52eaa238 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -6,7 +6,7 @@ <% if (htmlWebpackPlugin.options.nodeModules) { %> <% } %> @@ -14,7 +14,7 @@
diff --git a/src/main/communicator.js b/src/main/communicator.js index 96c683715..616f827ee 100644 --- a/src/main/communicator.js +++ b/src/main/communicator.js @@ -1,11 +1,19 @@ import { ipcMain } from "electron"; import { dialog } from "electron"; import fs from "fs"; -import path from "path"; import DirToJSON from "dir-to-json"; const base_path = `C:/Users/${process.env.USERNAME}/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/`; const behavior_path = base_path + "development_behavior_packs/"; +// ipcMain.on("getOpenedWithData", event => { +// let data = null; +// if(process.platform === "win32" && process.env.NODE_ENV !== "development" && process.argv.length >= 2) { +// let to_open = process.argv[1]; +// data = to_open; +// } +// event.returnValue = data +// }); + ipcMain.on("getProjects", (event, args) => { fs.readdir(base_path + "development_behavior_packs", (err, files) => { if(err) console.log(err); diff --git a/src/main/index.js b/src/main/index.js index 30c8e54ae..585e97941 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -1,4 +1,4 @@ -import { app, BrowserWindow, ipcMain, Menu } from 'electron' +import { app, BrowserWindow, ipcMain, Menu } from "electron"; import "./communicator.js"; import "./Discord"; @@ -41,6 +41,7 @@ function createWindow () { mainWindow.webContents.on('did-finish-load', () => { if(loadingWindow) { mainWindow.setPosition(...loadingWindow.getPosition()); + // mainWindow.toggleDevTools(); loadingWindow.close(); mainWindow.show(); } @@ -77,23 +78,46 @@ function createSplashScreen() { }); } -app.on('ready', () => { - createWindow(); - createSplashScreen(); -}) +function openFile(file) { + mainWindow.webContents.send("openFile", file) +} + +const quit = app.makeSingleInstance((argv) => { + // Someone tried to run a second instance, we should focus our window. + if(loadingWindow) { + if(loadingWindow.isMinimized()) loadingWindow.restore(); + loadingWindow.focus(); + } else if(mainWindow) { + if(mainWindow.isMinimized()) mainWindow.restore(); + mainWindow.focus(); + } + + console.log(argv); + openFile(argv[1]); +}); + +if (quit && process.argv.length >= 2 && process.env.NODE_ENV !== "development") { + app.quit(); +} else { + app.on('ready', () => { + createWindow(); + createSplashScreen(); + }); +} app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit(); } -}) +}); app.on('activate', () => { if (mainWindow === null) { createWindow(); } -}) +}); +ipcMain.on("toggleDevTools", function() { mainWindow.toggleDevTools(); }); /** * Auto Updater diff --git a/src/renderer/components/plugin_install/CloudPlugin.vue b/src/renderer/components/plugin_install/CloudPlugin.vue index 64a50e297..24edf0560 100644 --- a/src/renderer/components/plugin_install/CloudPlugin.vue +++ b/src/renderer/components/plugin_install/CloudPlugin.vue @@ -33,7 +33,7 @@