electron/spec/fixtures/api/singleton-userdata/main.js
Samuel Attard 122685194a
build: add import/order eslint rule (#44085)
* build: add import/order eslint rule

* chore: run lint:js --fix
2024-10-02 19:10:44 -07:00

13 lines
517 B
JavaScript

const { app } = require('electron');
const fs = require('node:fs');
const path = require('node:path');
// non-existent user data folder should not break requestSingleInstanceLock()
// ref: https://github.com/electron/electron/issues/33547
const userDataFolder = path.join(app.getPath('home'), 'electron-test-singleton-userdata');
fs.rmSync(userDataFolder, { force: true, recursive: true });
app.setPath('userData', userDataFolder);
const gotTheLock = app.requestSingleInstanceLock();
app.exit(gotTheLock ? 0 : 1);