Electron Notification can't show the exact name where my app is at C://Program Files.Window10

40 Views Asked by At

Electron Notification can't show the exact name where my app is at C://Program Files, The notification just show my app's path, not the app's name

when I move my app to C:/ , and create a shortcuts, the notification shows my app's name properly when I move my app to C:/Program Files , and create a shortcuts, the notification shows my app's file path, this is not right. I want myApp can be installed at C:/Program Files and the notification can show it's name exactly. Image:when my app is at C:/Program Files

Image:When my app is not at C:/Program Files

My code


function createWindow () {
  const win = new BrowserWindow({
    width: 800,
    height: 600
  })

  win.loadFile('index.html')
}

const NOTIFICATION_TITLE = 'Basic Notification'
const NOTIFICATION_BODY = 'Notification from the Main process'

function showNotification () {
  new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
app.setAppUserModelId(process.execPath)
app.whenReady().then(createWindow).then(showNotification)

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', () => {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow()
  }
})
0

There are 0 best solutions below