Skip to content

Commit

Permalink
Use the system xdg-open on Linux when open is bundled/packaged (#134
Browse files Browse the repository at this point in the history
)

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
marcellourbani and sindresorhus committed May 12, 2019
1 parent 2fdb0e2 commit c69fd06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Expand Up @@ -73,7 +73,10 @@ module.exports = async (target, options) => {
if (options.app) {
command = options.app;
} else {
const useSystemXdgOpen = process.versions.electron || process.platform === 'android';
// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.
const isBundled = !__dirname || __dirname === '/';

const useSystemXdgOpen = process.versions.electron || process.platform === 'android' || isBundled;
command = useSystemXdgOpen ? 'xdg-open' : path.join(__dirname, 'xdg-open');
}

Expand Down

0 comments on commit c69fd06

Please sign in to comment.