mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Merge pull request #5832 from atom/bf-remove-path-bug-fix
Fix a bug when a URI is passed to atom.project.removePath().
This commit is contained in:
@@ -436,6 +436,23 @@ describe "Project", ->
|
||||
expect(atom.project.getPaths()).toEqual([path.join(__dirname, "..", "src")])
|
||||
expect(atom.project.getRepositories()[0].isSubmodule("src")).toBe false
|
||||
|
||||
it "removes a path that is represented as a URI", ->
|
||||
ftpURI = "ftp://example.com/some/folder"
|
||||
directoryProvider =
|
||||
directoryForURISync: (uri) ->
|
||||
# Dummy implementation of Directory for which GitRepositoryProvider
|
||||
# will not try to create a GitRepository.
|
||||
getPath: -> ftpURI
|
||||
getSubdirectory: -> {}
|
||||
isRoot: -> true
|
||||
off: ->
|
||||
atom.packages.serviceHub.provide(
|
||||
"atom.directory-provider", "0.1.0", directoryProvider)
|
||||
atom.project.setPaths([ftpURI])
|
||||
expect(atom.project.getPaths()).toEqual [ftpURI]
|
||||
atom.project.removePath(ftpURI)
|
||||
expect(atom.project.getPaths()).toEqual []
|
||||
|
||||
describe ".relativize(path)", ->
|
||||
it "returns the path, relative to whichever root directory it is inside of", ->
|
||||
atom.project.addPath(temp.mkdirSync("another-path"))
|
||||
|
||||
@@ -221,7 +221,9 @@ class Project extends Model
|
||||
#
|
||||
# * `projectPath` {String} The path to remove.
|
||||
removePath: (projectPath) ->
|
||||
projectPath = path.normalize(projectPath)
|
||||
# The projectPath may be a URI, in which case it should not be normalized.
|
||||
unless projectPath in @getPaths()
|
||||
projectPath = path.normalize(projectPath)
|
||||
|
||||
indexToRemove = null
|
||||
for directory, i in @rootDirectories
|
||||
|
||||
Reference in New Issue
Block a user