electron / electron/forge

Shortcuts poiting to the worng exe file, and so, not starting application

Open
#2,163 3 comments 2 reactions 0 assignees View on GitHub
documentation maker/squirrel
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 17m
Merged PRs (30d)
32

Description

### Preflight Checklist

* [x] I have read the [contribution documentation](https://github.com/electron-userland/electron-forge/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project follows, as appropriate.
* [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.

### Issue Details

* **Electron Forge Version:**
`6.0.0-beta.54`
* **Electron Version:**
`v11.2.3`
* **Operating System:**
Windows 10

### Actual Behavior
The start menu and desktop created shortcuts are poiting to `$HOME/AppData/local/mypackage/mypackage.exe` and the working .exe file is in `$HOME/AppData/local/mypackage/app-0.0.0/mypackage.exe`

### Expected Behavior
The created shortcuts should point to the right .exe and start the aplication properly. If I click on the right file, the aplication starts just fine.

### To Reproduce

main.js:
```javascript
if(require('electron-squirrel-startup')) return;
const { app, BrowserWindow, globalShortcut } = require('electron');
const nativeImage = require('electron').nativeImage;

let win;
const image = nativeImage.createFromPath(__dirname + 'favicon.ico');
image.setTemplateImage(true);
// this should be placed at top of main.js to handle seup events quickly.
// squirrel event handled and app will exit in 1000ms, so don't do anything else
// if(handleSquirrelEvent()) return;

function createWindow() {
win = new BrowserWindow({
width: 1200,
height: 800,
backgroundColor: '#ffffff',
icon: image,
webPreferences: {
nodeIntegration: true
}
});

win.loadURL(`file://${__dirname}/dist/iq-web-bot/index.html`);

// uncomment below to open the DevTools
// win.webContents.openDevTools()

win.on('closed', function() {
win = null;
});
}

// create window on electron initialization
app.on('ready', function() {
createWindow();

globalShortcut.register('f5', function() {
console.log('f5 is pressed')
win.reload()
})
globalShortcut.register('CommandOrControl+R', function() {
console.log('CommandOrControl+R is pressed')
win.reload()
})
})

// quit when all windows are closed
app.on('window-all-closed', function () {

// on macOS specific close process
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', function() {
if (win == null) {
createWindow();
}
});
```

resumed package.json

```json
{
"name": "iq-web-bot",
"productName": "iq-web-bot",
"description": "Web and Native Bot for IQ Option awesome investments and profit.",
"version": "0.0.0",
"main": "main.js",
"scripts": {
"ng": "ng",
"build-forge": "ng build --configuration local",
"package": "electron-forge package",
"make": "electron-forge make",
"make-linux": "electron-forge make --platform linux --targets @electron-forge/maker-deb",
"make-win": "electron-forge make --platform win32 --targets @electron-forge/maker-squirrel",
"forge-linux": "npm run build-forge && npm run make-linux",
"forge-win": "npm run build-forge && npm run make-win",
},
"private": true,
"dependencies": {
"buffer": "^5.6.0",
"child_process": "^1.0.2",
"electron-squirrel-startup": "^1.0.0",
"firebase": "^7.19.1",
"lodash": "^4.17.20",
"moment": "^2.27.0",
"ngx-mask": "^10.0.1",
"ngx-socket-io": "^3.2.0",
"os": "^0.1.1",
"path": "^0.12.7",
"rxjs": "^6.6.3",
"source-map-loader": "^1.0.1",
"tslib": "^2.0.0",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.54",
"@electron-forge/maker-deb": "^6.0.0-beta.54",
"@electron-forge/maker-dmg": "^6.0.0-beta.54",
"@electron-forge/maker-rpm": "^6.0.0-beta.54",
"@electron-forge/maker-squirrel": "^6.0.0-beta.54",
"@electron-forge/maker-zip": "^6.0.0-beta.54",
"@tailwindcss/custom-forms": "^0.2.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.12.54",
"electron": "^11.2.3",
"electron-packager": "^15.2.0",
"electron-winstaller": "^4.0.2",
},
"config": {
"forge": "./forge.config.js"
}
}
```

config.js

```javascript
const path = require('path');

module.exports = {
packagerConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
iconUrl: 'https://iqwebbot.com/favicon.ico',
setupIcon: path.join(__dirname, 'src', 'assets', 'logo-blue.ico'),
name: 'iq-web-bot',
authors: 'Leonardo Rick',
}
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin']
},
{
name: '@electron-forge/maker-deb',
config: {
icon: './dist/iq-web-bot/assets/logo-gray.png'
}
},
{
name: '@electron-forge/maker-rpm',
config: {}
},
{
name: '@electron-forge/maker-dmg',
config: {
background: './assets/dmg-background.png',
format: 'ULFO'
}
}
]
}
```
this is the level of the .exe pointed by the shortcuts
![image](https://user-images.githubusercontent.com/17517057/107887570-c238ca80-6ee5-11eb-9442-e3e990331642.png)

this is lthe level it should be poiting:

![image](https://user-images.githubusercontent.com/17517057/107887566-ba792600-6ee5-11eb-8c5c-8378c9d7b577.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.