mirror of
https://github.com/atom/atom.git
synced 2026-02-09 06:05:11 -05:00
25 lines
523 B
CoffeeScript
25 lines
523 B
CoffeeScript
fs = require 'fs'
|
|
Buffer = require 'buffer'
|
|
|
|
module.exports =
|
|
|
|
class Project
|
|
buffers: null
|
|
|
|
constructor: (@path) ->
|
|
@buffers = {}
|
|
|
|
getFilePaths: ->
|
|
projectPath = @path
|
|
fs.async.listTree(@path).pipe (paths) ->
|
|
path.replace(projectPath, "") for path in paths when fs.isFile(path)
|
|
|
|
open: (filePath) ->
|
|
filePath = @resolve filePath
|
|
@buffers[filePath] ?= new Buffer(filePath)
|
|
|
|
resolve: (filePath) ->
|
|
filePath = fs.join(@path, filePath) unless filePath[0] == '/'
|
|
fs.absolute filePath
|
|
|