首页 > node-webkit 如何获取当前路径?

node-webkit 如何获取当前路径?

当node-webkit的应用运行时,会在临时目录里边产生一些临时文件,node-webkit就是在这个临时目录里边运行的,那么如何获取程序的真实路径?


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));
【热门文章】
【热门文章】