设置 NSTask 工作目录

Set NSTask working directory

如何设置 NSTask 的工作目录。显而易见的选择是 currentDirectoryPath,但是 it is deprecated.

我运行ning的程序需要运行在特定目录下。

显而易见的选择currentDirectoryURL

Apple 将用 (NS)URL 相关的 API.

替换所有 (NS)String 路径相关的 API
  • currentDirectoryPath 在 10.13 中已弃用,但仍可运行。
  • currentDirectoryURL 在 10.13 中引入。

launchPath 也会变成 executableURL