Javascript phantomjs 获取当前绝对路径
阅读(3312)获取当前运行的绝对路径 fs.workingDirectory:
var fs = require('fs');
console.log(fs.workingDirectory);
获取当前脚本的绝对路径 fs.absolute():
var fs = require('fs');
var system = require('system');
console.log(fs.absolute(system.args[0])); // system.args[0]为当前传入的脚本相对路径
Refer:
http://phantomjs.org/api/fs/property/working-directory.html
http://phantomjs.org/api/fs/method/absolute.html