我想.tex
用 Swift 编译一个文件。我有以下代码:
class FileManager {
class func compileLatex(#file: String) {
let task = NSTask()
task.launchPath = "/usr/texbin/latexmk"
task.currentDirectoryPath = (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! String).stringByAppendingString("/roster")
task.arguments = ["-xelatex", file]
task.launch()
}
}
但是,在调用时,FileManager.compileLatex(file: "latex.tex")
我收到错误“无法访问启动路径”。显然,启动路径是错误的,但我不知道如何找出它的真正含义?我怎样才能找到或有一般的路径?谢谢你的帮助
编辑:
更新代码并收到此错误:
Latexmk: This is Latexmk, John Collins, 10 January 2015, version: 4.42.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'xelatex -recorder "Praktikumsbericht.tex"'
------------
sh: xelatex: command not found
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: (Pdf)LaTeX failed to generate the expected log file 'Praktikumsbericht.log'
Latexmk: Did not finish processing file 'Praktikumsbericht.tex':
(Pdf)LaTeX failed to generate the expected log file 'Praktikumsbericht.log'
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.