mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Make project.resolve work on Windows
This commit is contained in:
@@ -38,6 +38,18 @@ fsExtensions =
|
||||
catch e
|
||||
relativePath
|
||||
|
||||
# Public: Is the given path absolute?
|
||||
#
|
||||
# * pathToCheck:
|
||||
# The relative or absolute path to check.
|
||||
#
|
||||
# Returns true if the path is absolute, false otherwise.
|
||||
isAbsolute: (pathToCheck='') ->
|
||||
if process.platform is 'win32'
|
||||
pathToResolve[1] is ':' # C:\ style
|
||||
else
|
||||
pathToResolve[0] is '/' # /usr style
|
||||
|
||||
# Public: Returns true if a file or folder at the specified path exists.
|
||||
exists: (pathToCheck) ->
|
||||
# TODO: rename to existsSync
|
||||
@@ -290,12 +302,7 @@ fsExtensions =
|
||||
pathToResolve = args.pop()
|
||||
loadPaths = args
|
||||
|
||||
if process.platform is 'win32'
|
||||
isAbsolute = pathToResolve[1] is ':' # C:\ style
|
||||
else
|
||||
isAbsolute = pathToResolve[0] is '/' # /usr style
|
||||
|
||||
if isAbsolute
|
||||
if @isAbsolute(pathToResolve)
|
||||
if extensions and resolvedPath = @resolveExtension(pathToResolve, extensions)
|
||||
return resolvedPath
|
||||
else
|
||||
|
||||
@@ -157,7 +157,7 @@ class Project
|
||||
if uri?.match(/[A-Za-z0-9+-.]+:\/\//) # leave path alone if it has a scheme
|
||||
uri
|
||||
else
|
||||
uri = path.join(@getPath(), uri) unless uri[0] == '/'
|
||||
uri = path.join(@getPath(), uri) unless fsUtils.isAbsolute(uri)
|
||||
fsUtils.absolute uri
|
||||
|
||||
# Public: Make the given path relative to the project directory.
|
||||
|
||||
Reference in New Issue
Block a user