Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portable electron app is extracted in a different folder every time it opens; Can't use Auto-Launch ! #8739

Open
GeorgeFlorian opened this issue Dec 12, 2024 · 0 comments

Comments

@GeorgeFlorian
Copy link

GeorgeFlorian commented Dec 12, 2024

I am building an app in which I am trying to use Auto-Launch, but I can't, because every time the app runs, it gets unpacked in a different temporary folder.

I building a portable app using these settings:

{
  "name": "automat-parcare-kiosk",
  "private": true,
  "version": "1.0.0",
  "type": "module",
  "main": "electron/main.js",
  "build": {
    "electronVersion": "32.1.2",
    "appId": "com.ceva.automat-plata-parcare",
    "productName": "Ceva - Automat Plata Parcare",
    "directories": {
      "output": "dist_electron",
      "buildResources": "build"
    },
    "files": [
      "dist/**/*",
      "electron/**/*",
      "build/**/*"
    ],
    "win": {
      "target": "portable",
      "icon": "build/m_icon.ico",
      "artifactName": "Ceva-Automat-Plata-Parcare-${version}.exe"
    }
  },

I am copying it to Desktop and running it from Desktop, so why doesn't it point to it existing on Desktop ?

Why is a portable app getting "unpacked" every time it runs ? Why isn't it just an exe that just runs ?

Here are some logs:

// Log path using app.getAppPath() - the path to the app's source or packaged directory
log.info('app.getAppPath:', app.getAppPath());

// Log path using process.execPath - the path to the Electron executable
log.info('process.execPath:', process.execPath);

// Log path using process.argv[0] - the path to the Electron executable
log.info('process.argv[0]:', process.argv[0]);

// Log path using __dirname - the directory of the current executing script
log.info('__dirname:', __dirname);

// Log path using app.getPath('userData') - the path to the user data directory
log.info('app.getPath("userData"):', app.getPath('userData'));

// Log a manually resolved path (useful for testing)
log.info('Manually resolved path (assuming EXE name):', path.join(app.getAppPath(), 'Ceva-Automat-Plata-Parcare-1.0.0.exe'));

// Example: Resolving paths dynamically to see where the executable might be
log.info('Resolved path to executable (if running from package):', path.resolve(app.getAppPath(), 'Ceva-Automat-Plata-Parcare-1.0.0.exe'));

// Use app.getPath('exe') to get the location of the current executable on Windows (not applicable on Linux/macOS)
if (process.platform === 'win32') {
  log.info('app.getPath("exe") (Windows only):', app.getPath('exe'));
}
[2024-12-12 13:33:44.127] [info]  app.getAppPath: C:\Users\user\AppData\Local\Temp\2q7AFnpuMktS0Sw4jB8vcOd3hrA\resources\app.asar
[2024-12-12 13:33:44.129] [info]  process.execPath: C:\Users\user\AppData\Local\Temp\2q7AFnpuMktS0Sw4jB8vcOd3hrA\Ceva - Automat Plata Parcare.exe
[2024-12-12 13:33:44.130] [info]  process.argv[0]: C:\Users\user\AppData\Local\Temp\2q7AFnpuMktS0Sw4jB8vcOd3hrA\Ceva - Automat Plata Parcare.exe
[2024-12-12 13:33:44.132] [info]  __dirname: C:\Users\user\AppData\Local\Temp\2q7AFnpuMktS0Sw4jB8vcOd3hrA\resources\app.asar\electron
[2024-12-12 13:33:44.133] [info]  app.getPath("userData"): C:\Users\user\AppData\Roaming\automat-parcare-kiosk
[2024-12-12 13:33:44.135] [info]  Manually resolved path (assuming EXE name): C:\Users\user\AppData\Local\Temp\2q7AFnpuMktS0Sw4jB8vcOd3hrA\resources\app.asar\Ceva-Automat-Plata-Parcare-1.0.0.exe
[2024-12-12 13:33:44.136] [info]  Resolved path to executable (if running from package): C:\Users\user\AppData\Local\Temp\2q7AFnpuMktS0Sw4jB8vcOd3hrA\resources\app.asar\Ceva-Automat-Plata-Parcare-1.0.0.exe
[2024-12-12 13:33:44.138] [info]  app.getPath("exe") (Windows only): C:\Users\user\AppData\Local\Temp\2q7AFnpuMktS0Sw4jB8vcOd3hrA\Ceva - Automat Plata Parcare.exe
[2024-12-12 13:33:44.599] [info]  App will auto-start when Windows starts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant