diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 09ad8fb91..06e3ee29d 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -190,6 +190,11 @@ describe "Project", -> expect(atom.project.getPath()?).toBeFalsy() expect(atom.project.getRootDirectory()?).toBeFalsy() + it "normalizes the path to remove consecutive slashes, ., and .. segments", -> + atom.project.setPath("#{require.resolve('./fixtures/dir/a')}#{path.sep}b#{path.sep}#{path.sep}..") + expect(atom.project.getPath()).toEqual path.dirname(require.resolve('./fixtures/dir/a')) + expect(atom.project.getRootDirectory().path).toEqual path.dirname(require.resolve('./fixtures/dir/a')) + describe ".replace()", -> [filePath, commentFilePath, sampleContent, sampleCommentContent] = [] diff --git a/src/project.coffee b/src/project.coffee index c0b81ddd0..bf2adf2c3 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -84,6 +84,7 @@ class Project extends Model # # * `projectPath` {String} path setPath: (projectPath) -> + projectPath = path.normalize(projectPath) if projectPath @path = projectPath @rootDirectory?.off()