Skip to content

Commit

Permalink
Removed open dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptspry committed Nov 3, 2016
1 parent a9fd7f8 commit 5bea3cd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
23 changes: 22 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,28 @@ const BrowserWindow = electron.BrowserWindow
const path = require('path')

// Open external urls in default browser
const open = require('open')
const open = function (target, appName, callback) {
var opener;

if (typeof(appName) === 'function') {
callback = appName;
appName = null;
}

if (appName)
opener = 'open -a "' + escape(appName) + '"';
else
opener = 'open';

if (process.env.SUDO_USER)
opener = 'sudo -u ' + process.env.SUDO_USER + ' ' + opener;

return exec(opener + ' "' + escape(target) + '"', callback);
}

function escape(s) {
return s.replace(/"/g, '\\\"');
}

// Module to bind media shortcuts
const globalShortcut = require('electron').globalShortcut
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"homepage": "http://scriptspry.com/2016/07/30/saavn-mac-app.html",
"devDependencies": {
"electron-packager": "^8.2.0",
"electron-prebuilt": "^1.4.5",
"open": "^0.0.5"
"electron-prebuilt": "^1.4.5"
}
}

0 comments on commit 5bea3cd

Please sign in to comment.