mirror of
https://github.com/atom/atom.git
synced 2026-02-11 15:14:59 -05:00
Update require.coffee from CEF 1 atom
This commit is contained in:
@@ -19,10 +19,12 @@ nakedLoad = (file) ->
|
||||
code = __read file
|
||||
window.eval(code + "\n//@ sourceURL=" + file)
|
||||
|
||||
require = (file, cb) ->
|
||||
return cb require file if cb?
|
||||
require = (path, cb) ->
|
||||
return cb require path if cb?
|
||||
|
||||
unless file = resolve(path)
|
||||
throw new Error("Require can't find file at path '#{path}'")
|
||||
|
||||
file = resolve file
|
||||
parts = file.split '.'
|
||||
ext = parts[parts.length-1]
|
||||
|
||||
@@ -88,10 +90,10 @@ resolve = (file) ->
|
||||
else
|
||||
file = __expand(file) or file
|
||||
|
||||
if file[0] isnt '/'
|
||||
throw "require: Can't find '#{file}'"
|
||||
|
||||
return file
|
||||
if file[0] == '/'
|
||||
file
|
||||
else
|
||||
null
|
||||
|
||||
__expand = (path) ->
|
||||
return path if __isFile path
|
||||
|
||||
Reference in New Issue
Block a user