From eaa47e7d9238180eb8c428e7c42e3a7a7196ffe3 Mon Sep 17 00:00:00 2001 From: Lucas Dower Date: Thu, 31 Mar 2022 20:37:02 +0100 Subject: [PATCH] Added version to window title bar --- index.html | 1 - package.json | 4 ++-- src/main.ts | 12 ++++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 88f07f6..24a8a8b 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,6 @@ - ObjToSchematic – Convert 3D models into Minecraft builds diff --git a/package.json b/package.json index b20ff74..6f62836 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "objtoschematic", - "version": "0.4.0", + "version": "0.5.0", "description": "A tool to convert .obj files into voxels and then into Minecraft Schematic files", "main": "./dist/src/main.js", "engines": { @@ -16,7 +16,7 @@ "atlas": "node ./dist/tools/build-atlas.js", "palette": "node ./dist/tools/build-palette.js", "headless": "node ./dist/tools/headless.js", - "export": "electron-packager . ObjToSchematic --platform=win32 --arch=x64" + "package:win64": "electron-packager . ObjToSchematic --platform=win32 --arch=x64 --app-version=0.5.0" }, "repository": { "type": "git", diff --git a/src/main.ts b/src/main.ts index af5cee7..b7bf829 100644 --- a/src/main.ts +++ b/src/main.ts @@ -43,8 +43,7 @@ function createWindow() { }, }); // mainWindow.removeMenu(); - - + // Load index.html mainWindow.loadURL(url.format({ pathname: path.join(BASE_DIR, './index.html'), @@ -52,6 +51,15 @@ function createWindow() { slashes: true, })); + const baseTitle = 'ObjToSchematic – Convert 3D models into Minecraft builds'; + try { + const branchName = require('child_process').execSync('git rev-parse --abbrev-ref HEAD'); + const commitHash = require('child_process').execSync('git rev-parse --short HEAD'); + mainWindow.setTitle(`${baseTitle} (git//${branchName}++${commitHash})`); + } catch (e: any) { + mainWindow.setTitle(`${baseTitle} (release//v0.5.0)`); + } + // Open the DevTools. // mainWindow.webContents.openDevTools();