mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Add Project.open, which returns a buffer for an absolute/relative path.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user