     @state.get('relativePath')
 
   setRelativePath: (relativePath) ->
-    @setPath(project.resolve(relativePath))
+    @setPath(@project.resolve(relativePath))
 
   # Sets the path for the file.
   #

  # initialText - A {String} setting the starting text
  constructor: (optionsOrState={}, params={}) ->
    if optionsOrState instanceof telepath.Document
      @state = optionsOrState
      @text = @state.get('text')
      filePath = @state.get('relativePath')
      @id = @state.get('id')
    else
      {filePath, initialText} = optionsOrState
      @text = site.createDocument(initialText, shareStrings: true) if initialText
      @id = guid.create().toString()
      @state = site.createDocument

  checkoutHead: ->
    path = @getPath()
    return unless path
    @project.getRepo()?.checkoutHead(path)

  # Checks to see if a file exists.
  #
