Skip to content

Commit

Permalink
it works on windows now! cobr release
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonn Spencer committed Jul 17, 2020
1 parent 7fc6566 commit 92ce61a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 35 deletions.
24 changes: 14 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ const url = require('url');
function createWindow() {
// Create the browser window.
const win = new BrowserWindow({
width: 667,
height: 627,
width: 690,
height: 650,
webPreferences: {
nodeIntegration: true,
}
});

win.removeMenu();

win.loadURL(url.format({
pathname: path.join(__dirname, 'electron-client/dist/electron-client/index.html'),
// pathname: path.join(__dirname, 'electron-client/dist/electron-client/index.html'),
pathname: path.normalize('electron-client/dist/electron-client/index.html'),
protocol: 'file:',
slashes: true,
}));

// Open the DevTools.
win.webContents.openDevTools();
// win.webContents.openDevTools();
}

// // This method will be called when Electron has finished
Expand All @@ -33,17 +36,18 @@ function createWindow() {

app.whenReady().then(() => {
protocol.interceptFileProtocol('file', (request, callback) => {
let url = request.url.substr('file://'.length); /* all urls start with 'file://' */
console.error(`request for file=${url}. current path is ${__dirname}`);
let url = path.normalize(request.url);
console.error(`request for file=${url}.\ncurrent path is ${__dirname}`);
url = url.substr(path.normalize('file://').length); /* all urls start with 'file://' */

if (url.startsWith(__dirname)) {
url = url.substring(__dirname.length);
}

// Kinda works.
if (url === '/electron-client/dist/' || url.indexOf('electron-client/g/') != -1) {
url = 'electron-client/dist/electron-client/index.html';
}
//// Kinda works.
//if (url === path.normalize('/electron-client/dist/') || url.indexOf(path.normalize('electron-client/g/') != -1)) {
// url = path.normalize('electron-client/dist/electron-client/index.html');
//}

console.error(`repaired ${path.join(__dirname, url)}`);
callback({ path: path.join(__dirname, url)});
Expand Down
57 changes: 34 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"jyuunikyara:buildprod": "npm run buildprod --prefix jyuunikyara/",
"package": "npm run buildprod && electron-packager . \"Smash Display (alpha)\" --all --overwrite --out=release-builds --ignore=^/jyuunikyara",
"package-mac": "electron-packager . \"Smash Display (alpha)\" --platform=darwin --arch=x64 --overwrite --out=release-builds --ignore=^/jyuunikyara",
"package-win-old": "electron-packager . \"Smash Display (alpha)\" --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Smash Display\"",
"package-win": "electron-packager . \"Smash Display (alpha)\" --overwrite --asar=true --platform=win32 --arch=ia32 --out=release-builds --ignore=^/jyuunikyara",
"package-win": "electron-packager . \"Smash Display (alpha)\" --asar --overwrite --platform=win32 --arch=ia32 --out=release-builds --ignore=^/jyuunikyara --prune",
"package-linux": "electron-packager . \"Smash Display (alpha)\" --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds"
},
"repository": {
Expand All @@ -28,6 +27,7 @@
},
"homepage": "https://github.com/hopskipnfall/12cb-desktop#readme",
"devDependencies": {
"asar": "^3.0.3",
"electron": "^8.3.0",
"electron-packager": "^14.2.1",
"node-static": "^0.7.11",
Expand Down

0 comments on commit 92ce61a

Please sign in to comment.