Advertisement
reebypastalina

min.js

May 19th, 2024
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/@ELECTRON@
  2.  
  3. const name = 'min';
  4.  
  5. const {app} = require('electron');
  6. const fs = require('fs');
  7. const path = require('path');
  8.  
  9. // Change command name.
  10. const fd = fs.openSync('/proc/self/comm', fs.constants.O_WRONLY);
  11. fs.writeSync(fd, name);
  12. fs.closeSync(fd);
  13.  
  14. // Remove first command line argument (/usr/bin/electron).
  15. process.argv.splice(0, 1);
  16.  
  17. // Set application paths.
  18. const appPath = path.join(path.dirname(__dirname), name);
  19. const packageJson = require(path.join(appPath, 'package.json'));
  20. const productName = packageJson.productName;
  21. app.setAppPath(appPath);
  22. app.setDesktopName(name + '.desktop');
  23. app.setName(productName);
  24. app.setPath('userCache', path.join(app.getPath('cache'), productName));
  25. app.setPath('userData', path.join(app.getPath('appData'), productName));
  26. app.setVersion(packageJson.version);
  27.  
  28. // Run the application.
  29. require('module')._load(appPath, module, true);
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement