Make paths absolute before calling $native.watchPath

Also return a subscription that can be unwatched instead
of returning an id that is later passed to $native.unwatchPath
along with the watched path.

This allows specs to pass when run from a symlink'ed folder.
This commit is contained in:
Corey Johnson & Kevin Sawicki
2013-03-20 13:27:49 -07:00
parent ae96a48572
commit 6c357aaca7
5 changed files with 17 additions and 18 deletions

View File

@@ -19,10 +19,7 @@ module.exports =
home = process.env.HOME
path = "#{home}#{path.substring(1)}"
try
path = fs.realpathSync(path)
if process.platform is 'darwin' and path.indexOf('/private/') is 0
path = path.substring(8)
path
fs.realpathSync(path)
catch e
path
@@ -285,3 +282,8 @@ module.exports =
cson.readObject(path)
else
@readPlist(path)
watchPath: (path, callback) ->
path = @absolute(path)
id = $native.watchPath(path, callback)
unwatch: -> $native.unwatchPath(path, id)