Function: TeX--master-output-dir

TeX--master-output-dir is a byte-compiled function defined in tex.el.

Signature

(TeX--master-output-dir MASTER-DIR RELATIVE-TO-MASTER &optional ENSURE)

Documentation

Return the directory path where output files should be placed.

If TeX-output-dir is nil, then return nil.

MASTER-DIR is the directory path where the master file is located. If RELATIVE-TO-MASTER is non-nil, make the returned path relative to the directory in MASTER-DIR. If ENSURE is non-nil, the output directory is created if it does not exist.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX--master-output-dir (master-dir relative-to-master &optional ensure)
  "Return the directory path where output files should be placed.
If `TeX-output-dir' is nil, then return nil.

MASTER-DIR is the directory path where the master file is
located.  If RELATIVE-TO-MASTER is non-nil, make the returned
path relative to the directory in MASTER-DIR.  If ENSURE is
non-nil, the output directory is created if it does not exist."
  (when TeX-output-dir
    (let* ((master-dir (expand-file-name (or master-dir "")))
           (out-dir (file-name-as-directory
                     (abbreviate-file-name
                      (substitute-in-file-name
                       (expand-file-name
                        TeX-output-dir
                        master-dir))))))
      ;; Make sure the directory exists
      (unless (or (not ensure) (file-exists-p out-dir))
        (make-directory (file-name-as-directory out-dir) t))
      (if relative-to-master
          (file-relative-name out-dir master-dir)
        out-dir))))