nwjs怎么获取app所在的目录
打包后的nwjs应用在运行时,会随机将app目录解压到c盘user appdata的temp目录中,怎么在运行时获取这个随机的目录位置?
fdssa
10 years ago
Answers
I want to build some data on the current directory ? But how to get the current directory?
console.log(__dirname)
I try that, but it doesn't work.
I want a little help.
Some temp files were built in the temp directory when it work on. How to get the real dirname?
answer:
Just so you know your project is compressed, packed, and concatenated into the binary. So when it runs it will unpack to a temp directory in order to be accessed.
Get path of project directory (temp dir):
console.log(process.cwd());
Get path of project binary:
var path = require("path");
console.log(path.dirname(process.execPath));
♀吉祥物♂
answered 10 years ago