mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Don't resolve uris when project has not path
This commit is contained in:
@@ -156,10 +156,18 @@ describe "Project", ->
|
||||
expect(atom.project.resolve('a')).toBe absolutePath
|
||||
expect(atom.project.resolve(absolutePath + '/../a')).toBe absolutePath
|
||||
expect(atom.project.resolve('a/../a')).toBe absolutePath
|
||||
expect(atom.project.resolve()).toBeUndefined()
|
||||
|
||||
describe "when passed a uri with a scheme", ->
|
||||
it "does not modify uris that begin with a scheme", ->
|
||||
expect(atom.project.resolve('http://zombo.com')).toBe 'http://zombo.com'
|
||||
atom.project.setPath()
|
||||
expect(atom.project.resolve('http://github.com')).toBe 'http://github.com'
|
||||
|
||||
describe "when the project has no path", ->
|
||||
it "returns undefined", ->
|
||||
atom.project.setPath()
|
||||
expect(atom.project.resolve('test.txt')).toBeUndefined()
|
||||
|
||||
describe ".setPath(path)", ->
|
||||
describe "when path is a file", ->
|
||||
|
||||
@@ -98,8 +98,8 @@ class Project extends Model
|
||||
|
||||
if uri?.match(/[A-Za-z0-9+-.]+:\/\//) # leave path alone if it has a scheme
|
||||
uri
|
||||
else
|
||||
uri = path.join(@getPath(), uri) unless fs.isAbsolute(uri)
|
||||
else if projectPath = @getPath()
|
||||
uri = path.join(projectPath, uri) unless fs.isAbsolute(uri)
|
||||
fs.absolute(uri)
|
||||
|
||||
# Public: Make the given path relative to the project directory.
|
||||
|
||||
Reference in New Issue
Block a user