diff --git a/spec/default-directory-provider-spec.coffee b/spec/default-directory-provider-spec.coffee index 69370a77b..357348c4a 100644 --- a/spec/default-directory-provider-spec.coffee +++ b/spec/default-directory-provider-spec.coffee @@ -31,6 +31,12 @@ describe "DefaultDirectoryProvider", -> directory = provider.directoryForURISync(file) expect(directory.getPath()).toEqual tmp + it "creates a Directory with a path as a uri when passed a uri", -> + provider = new DefaultDirectoryProvider() + uri = 'remote://server:6792/path/to/a/dir' + directory = provider.directoryForURISync(uri) + expect(directory.getPath()).toEqual uri + describe ".directoryForURI(uri)", -> it "returns a Promise that resolves to a Directory with a path that matches the uri", -> provider = new DefaultDirectoryProvider() diff --git a/spec/window-spec.coffee b/spec/window-spec.coffee index 376a71ab3..94e605a36 100644 --- a/spec/window-spec.coffee +++ b/spec/window-spec.coffee @@ -293,3 +293,14 @@ describe "Window", -> pathToOpen = __dirname atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] expect(atom.workspace.open.callCount).toBe 0 + + describe "when the opened path is a uri", -> + it "adds it to the project's paths as is", -> + pathToOpen = 'remote://server:7644/some/dir/path' + atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] + + waitsFor -> + atom.project.getPaths().length is 1 + + runs -> + expect(atom.project.getPaths()[0]).toBe pathToOpen diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 91e423d15..aeab5bf07 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -522,9 +522,8 @@ class AtomApplication new AtomWindow({bootstrapScript, @resourcePath, exitWhenDone, isSpec, specDirectory, devMode}) locationForPathToOpen: (pathToOpen) -> - {protocol} = url.parse(pathToOpen) - return {pathToOpen} if protocol? return {pathToOpen} unless pathToOpen + return {pathToOpen} if url.parse(pathToOpen).protocol? return {pathToOpen} if fs.existsSync(pathToOpen) pathToOpen = pathToOpen.replace(/[:\s]+$/, '') diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index 7c900ded6..96740f15a 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -24,9 +24,9 @@ class DefaultDirectoryProvider # TODO: Stop normalizing the path in pathwatcher's Directory. directory = new Directory(directoryPath) - if (url.parse(directoryPath).protocol) + if url.parse(directoryPath).protocol directory.path = directoryPath - if (fs.isCaseInsensitive()) + if fs.isCaseInsensitive() directory.lowerCasePath = directoryPath.toLowerCase() directory