I have an Portable Electron App (packed with: electron-builder + asar, portable build) on Windows. I try to get the application path but it returns a path within the user\\t
Seems like PORTABLE_EXECUTABLE_FILE only works under certain Electron-Builder configurations; In particular, it won't work in apps deployed as a portable directory.
In such cases, the following will get you the application root path:
const path = require('path')
import { app } from 'electron'
let rootDir = app.getAppPath()
let last = path.basename(rootDir)
if (last == 'app.asar') {
rootDir = Path.dirname(app.getPath('exe'))
}