diff --git a/src/core-uri-handlers.js b/src/core-uri-handlers.js index b2ddbbc25..e7f845609 100644 --- a/src/core-uri-handlers.js +++ b/src/core-uri-handlers.js @@ -1,3 +1,5 @@ +const fs = require('fs-plus') + // Converts a query string parameter for a line or column number // to a zero-based line or column number for the Atom API. function getLineColNumber (numStr) { @@ -17,7 +19,14 @@ function openFile (atom, {query}) { function windowShouldOpenFile ({query}) { const {filename} = query - return (win) => win.containsPath(filename) + const stat = fs.statSyncNoException(filename) + + return win => win.containsLocation({ + pathToOpen: filename, + exists: Boolean(stat), + isFile: stat.isFile(), + isDirectory: stat.isDirectory() + }) } const ROUTER = { @@ -39,7 +48,7 @@ module.exports = { if (config && config.getWindowPredicate) { return config.getWindowPredicate(parsed) } else { - return (win) => true + return () => true } } }