     return new OpenerImpl()
 
   moveResult: (result, filePath) ->
-    sourceDir = path.dirname(filePath)
-    outputFilePath = result.outputFilePath
-    result.outputFilePath = path.join(sourceDir, path.basename(outputFilePath))
-    fs.moveSync(outputFilePath, result.outputFilePath)
-    @pdfFile = result.outputFilePath
-
-    syncFilePath = outputFilePath.replace(/.pdf$/, '.synctex.gz')
+    originalFilePath = result.outputFilePath
+    result.outputFilePath = @alterParentPath(filePath, result.outputFilePath)
+    fs.moveSync(originalFilePath, result.outputFilePath)
+
+    syncFilePath = originalFilePath.replace(/\.pdf$/, '.synctex.gz')
     if fs.existsSync(syncFilePath)
-      fs.moveSync(syncFilePath, path.join(sourceDir, path.basename(syncFilePath)))
-
-  resolveRootFilePath: (path) ->
-    finder = new MasterTexFinder(path)
+      fs.moveSync(syncFilePath, @alterParentPath(filePath, syncFilePath))
+
+  resolveRootFilePath: (filePath) ->
+    finder = new MasterTexFinder(filePath)
     finder.getMasterTexPath()
+
+  resolveOutputFilePath: (filePath) ->
+    rootFilePath = @resolveRootFilePath(filePath)
+
+    unless outputFilePath = @outputLookup?[filePath]
+      builder = @getBuilder()
+      result = builder.parseLogFile(rootFilePath)
+      unless outputFilePath = result?.outputFilePath
+        console.info 'Log file parsing failed!' unless atom.inSpecMode()
+        return
+      @outputLookup ?= {}
+      @outputLookup[filePath] = outputFilePath
+
+    outputFilePath = @alterParentPath(rootFilePath, outputFilePath) if @shouldMoveResult()
+    outputFilePath
+
+  alterParentPath: (targetPath, originalPath) ->
+    targetDir = path.dirname(targetPath)
+    path.join(targetDir, path.basename(originalPath))
 
   shouldMoveResult: ->
     atom.config.get('latex.moveResultToSourceDirectory')

        @showError(error)
        return false

      @pdfFile = result.outputFilePath
      @moveResult(result, rootFilePath) if @shouldMoveResult()
      @showResult(result)


        console.info 'LaTeX clean did not find: ' + fileToRemove

  sync: ->
    {filePath, lineNumber} = @getEditorDetails()

    unless outputFilePath = @resolveOutputFilePath(filePath)
      unless atom.inSpecMode()
        console.info 'Could not resolve path to output file associated with the current file.'
      return

    if opener = @getOpener()
      opener.open(outputFilePath, filePath, lineNumber)

  isTexFile: (filePath) ->
    # TODO: Improve; will suffice for the time being.
