diff --git a/spec/default-directory-provider-spec.coffee b/spec/default-directory-provider-spec.coffee index 357348c4a..69370a77b 100644 --- a/spec/default-directory-provider-spec.coffee +++ b/spec/default-directory-provider-spec.coffee @@ -31,12 +31,6 @@ 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/integration/startup-spec.coffee b/spec/integration/startup-spec.coffee index d2583ed27..54817fedc 100644 --- a/spec/integration/startup-spec.coffee +++ b/spec/integration/startup-spec.coffee @@ -227,13 +227,3 @@ describe "Starting Atom", -> [tempDirPath] [otherTempDirPath] ].sort() - - describe "opening a remote directory", -> - it "opens the parent directory and creates an empty text editor", -> - remoteDirectory = 'remote://server:3437/some/directory/path' - runAtom [remoteDirectory], {ATOM_HOME: atomHome}, (client) -> - client - .waitForWindowCount(1, 1000) - .waitForExist("atom-workspace", 5000) - .treeViewRootDirectories() - .then ({value}) -> expect(value).toEqual([remoteDirectory]) diff --git a/spec/window-spec.coffee b/spec/window-spec.coffee index 94e605a36..376a71ab3 100644 --- a/spec/window-spec.coffee +++ b/spec/window-spec.coffee @@ -293,14 +293,3 @@ 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 5bd6be73e..1b2aa2e86 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -369,12 +369,7 @@ class AtomApplication # :windowDimensions - Object with height and width keys. # :window - {AtomWindow} to open file paths in. openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode, windowDimensions, profileStartup, window}={}) -> - pathsToOpen = pathsToOpen.map (pathToOpen) -> - if fs.existsSync(pathToOpen) - fs.normalize(pathToOpen) - else - pathToOpen - + pathsToOpen = (fs.normalize(pathToOpen) for pathToOpen in pathsToOpen) locationsToOpen = (@locationForPathToOpen(pathToOpen) for pathToOpen in pathsToOpen) unless pidToKillWhenClosed or newWindow @@ -523,7 +518,6 @@ class AtomApplication locationForPathToOpen: (pathToOpen) -> 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/browser/main.coffee b/src/browser/main.coffee index 371dd71ea..1af0526dd 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -5,7 +5,6 @@ app = require 'app' fs = require 'fs-plus' path = require 'path' yargs = require 'yargs' -url = require 'url' nslog = require 'nslog' console.log = nslog @@ -46,11 +45,9 @@ start = -> cwd = args.executedFrom?.toString() or process.cwd() args.pathsToOpen = args.pathsToOpen.map (pathToOpen) -> - normalizedPath = fs.normalize(pathToOpen) - if url.parse(pathToOpen).protocol? - pathToOpen - else if cwd - path.resolve(cwd, normalizedPath) + pathToOpen = fs.normalize(pathToOpen) + if cwd + path.resolve(cwd, pathToOpen) else path.resolve(pathToOpen) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index da2d17593..9e25e097b 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -1,7 +1,6 @@ {Directory} = require 'pathwatcher' fs = require 'fs-plus' path = require 'path' -url = require 'url' module.exports = class DefaultDirectoryProvider @@ -15,22 +14,14 @@ class DefaultDirectoryProvider # * {Directory} if the given URI is compatible with this provider. # * `null` if the given URI is not compatibile with this provider. directoryForURISync: (uri) -> - normalizedPath = path.normalize(uri) - {protocol} = url.parse(uri) - directoryPath = if protocol? - uri - else if not fs.isDirectorySync(normalizedPath) and fs.isDirectorySync(path.dirname(normalizedPath)) - path.dirname(normalizedPath) - else - normalizedPath + projectPath = path.normalize(uri) - # TODO: Stop normalizing the path in pathwatcher's Directory. - directory = new Directory(directoryPath) - if protocol? - directory.path = directoryPath - if fs.isCaseInsensitive() - directory.lowerCasePath = directoryPath.toLowerCase() - directory + directoryPath = if not fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath)) + path.dirname(projectPath) + else + projectPath + + new Directory(directoryPath) # Public: Create a Directory that corresponds to the specified URI. # diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 0855b27a1..7d67e87ab 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -5,7 +5,6 @@ ipc = require 'ipc' shell = require 'shell' {Subscriber} = require 'emissary' fs = require 'fs-plus' -url = require 'url' # Handles low-level events related to the window. module.exports = @@ -24,13 +23,12 @@ class WindowEventHandler if pathToOpen? and needsProjectPaths if fs.existsSync(pathToOpen) atom.project.addPath(pathToOpen) - else if fs.existsSync(path.dirname(pathToOpen)) - atom.project.addPath(path.dirname(pathToOpen)) else - atom.project.addPath(pathToOpen) + dirToOpen = path.dirname(pathToOpen) + if fs.existsSync(dirToOpen) + atom.project.addPath(dirToOpen) - {protocol} = url.parse(pathToOpen) - unless fs.isDirectorySync(pathToOpen) or protocol? + unless fs.isDirectorySync(pathToOpen) atom.workspace?.open(pathToOpen, {initialLine, initialColumn}) return