Dᴀʀ*_*ᴅᴇʀ 5 temporary-files tmp node.js electron
学习 Electron 我想在拖放后做一些文件处理。在 Mac 上,tmp 的等效项是$TMPDIR. 参考app我的 API 文档,我能够app.getAppPath()从 main.js 的简单控制台日志中找到显示我的路径的文件。下面app.getAppPath()是getPath()但是当我尝试时app.getPath(temp):
let foobar = app.getAppPath("temp")
console.log(foobar)
Run Code Online (Sandbox Code Playgroud)
我在控制台中收到以下错误:
参考错误:温度未定义
通过我的研究,我读到:
在 Electron 中,是否有内置的临时目录可以在所有操作系统上运行或process引用?
即使在引用了以下字符串之后:
console.log(`The temp path is: ${app.getAppPath("temp")}`)
Run Code Online (Sandbox Code Playgroud)
它返回与以下相同的响应:
console.log(`The AppPath is: ${app.getAppPath()}`)
Run Code Online (Sandbox Code Playgroud)
即:
The temp path is: /Users/Grim/Documents/GitHub/electron-quick-start-boilerplate
The AppPath is: /Users/Grim/Documents/GitHub/electron-quick-start-boilerplate
Run Code Online (Sandbox Code Playgroud)
并且上面的console.log测试是在letWindow.