Default directory provider should handle only local filesystem directories

This commit is contained in:
Mostafa Eweda
2015-02-27 15:49:18 -08:00
parent a3f64ddf7a
commit ad0669d814
2 changed files with 11 additions and 5 deletions

View File

@@ -21,7 +21,10 @@ class DefaultDirectoryProvider
else
path.dirname(projectPath)
new Directory(directoryPath)
if fs.isDirectorySync(projectPath)
return new Directory(directoryPath)
else
return null
# Public: Create a Directory that corresponds to the specified URI.
#

View File

@@ -39,6 +39,7 @@ class Project extends Model
@emitter = new Emitter
@buffers ?= []
@rootDirectories = []
@packageRootDirectoryPaths = []
@repositories = []
@directoryProviders = [new DefaultDirectoryProvider()]
@@ -203,10 +204,12 @@ class Project extends Model
for provider in @directoryProviders
break if directory = provider.directoryForURISync?(projectPath)
if directory is null
# This should never happen because DefaultDirectoryProvider should always
# return a Directory.
throw new Error(projectPath + ' could not be resolved to a directory')
@rootDirectories.push(directory)
# DefaultDirectoryProvider doesn't handle specific directory protocols
# Atom Packages may use packageDirectoryPaths to add thier own paths later.
@packageRootDirectoryPaths.push(projectPath)
return
else
@rootDirectories.push(directory)
repo = null
for provider in @repositoryProviders