Add Project.open, which returns a buffer for an absolute/relative path.

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-01-05 12:02:25 -08:00
parent 5293ba7469
commit 23c3cbf85f
2 changed files with 23 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
fs = require 'fs'
Buffer = require 'buffer'
module.exports =
@@ -8,3 +9,12 @@ class Project
getFilePaths: ->
fs.async.listFiles(@url, true)
open: (filePath) ->
new Buffer(@resolve(filePath))
resolve: (filePath) ->
if filePath[0] == '/'
filePath
else
fs.join(@url, filePath)