Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const childProcess = require('child_process');
- const path = require('path');
- const os = require('os');
- function createProgram(id, name, executable = "") {
- // SnoreToast/Program Name Here.lnk
- name = 'SnoreToast/' + name;
- if (!name.endsWith('.lnk')) {
- name += '.lnk';
- }
- const dir = path.dirname(require.resolve('node-notifier'));
- const exe = path.join(dir, 'vendor', 'snoreToast', `snoretoast-${os.arch()}.exe`);
- const args = [name, executable, id]
- .map(s => s.replace(/"/g, '\\"'))
- .join('" "');
- const cmd = `${exe} -install "${args}"`;
- console.log("If this doesn't work, run this command manually:");
- console.log(cmd);
- console.log();
- console.log("If that doesn't work, change the Program Name (in the terminal) and then try again.",
- "This should fix it, but this is a really finnicky process.");
- childProcess.execSync(cmd);
- }
- // Super finnicky. Give it a few minutes if it doesn't work right away.
- // Creating lots of these tends to cause some issues when done repeatedly.
- createProgram('ProgramName.UNIQUE_ID', 'Program Name Here');
Advertisement
Add Comment
Please, Sign In to add comment