Include remote paths, but skip normalization in the save/restore execution flow

This commit is contained in:
Mostafa Eweda
2015-05-18 19:03:59 -07:00
parent 564692fd30
commit d22eb697cc
4 changed files with 21 additions and 8 deletions

View File

@@ -763,8 +763,7 @@ class Atom extends Model
# Notify the browser project of the window's current project path
watchProjectPath: ->
@disposables.add @project.onDidChangePaths =>
@constructor.updateLoadSetting('initialPaths',
@project.getPaths().filter((projectPath) -> fs.existsSync(projectPath)))
@constructor.updateLoadSetting('initialPaths', @project.getPaths())
exit: (status) ->
app = remote.require('app')

View File

@@ -369,7 +369,12 @@ 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 = (fs.normalize(pathToOpen) for pathToOpen in pathsToOpen)
pathsToOpen = pathsToOpen.map (pathToOpen) ->
if fs.existsSync(pathToOpen)
fs.normalize(pathToOpen)
else
pathToOpen
locationsToOpen = (@locationForPathToOpen(pathToOpen) for pathToOpen in pathsToOpen)
unless pidToKillWhenClosed or newWindow
@@ -517,6 +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 fs.existsSync(pathToOpen)

View File

@@ -1,6 +1,7 @@
{Directory} = require 'pathwatcher'
fs = require 'fs-plus'
path = require 'path'
url = require 'url'
module.exports =
class DefaultDirectoryProvider
@@ -21,7 +22,13 @@ class DefaultDirectoryProvider
else
projectPath
new Directory(directoryPath)
# TODO: Stop normalizing the path in pathwatcher's Directory.
directory = new Directory(directoryPath)
if (url.parse(directoryPath).protocol)
directory.path = directoryPath;
if (fs.isCaseInsensitive())
directory.lowerCasePath = directoryPath.toLowerCase();
directory
# Public: Create a Directory that corresponds to the specified URI.
#

View File

@@ -23,12 +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
dirToOpen = path.dirname(pathToOpen)
if fs.existsSync(dirToOpen)
atom.project.addPath(dirToOpen)
atom.project.addPath(pathToOpen)
unless fs.isDirectorySync(pathToOpen)
if fs.isFileSync(pathToOpen)
atom.workspace?.open(pathToOpen, {initialLine, initialColumn})
return