Check on the existence of report directory

Reports will be written at rtcBot/test/reports/<report_name>

R=andresp@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/26689004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7372 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
houssainy@google.com 2014-10-06 17:21:27 +00:00
parent 42684be21b
commit 5d3e7ac1a3

View File

@ -121,9 +121,19 @@ StatisticsReport.prototype = {
},
finish: function (doneCallback) {
fs.writeFile("test/reports/" + this.outputFileName_ + "_" +
fs.exists("test/reports/", function (exists) {
if(exists) {
writeFile.bind(this)();
} else {
fs.mkdir("test/reports/", 0777, writeFile.bind(this));
}
}.bind(this));
function writeFile () {
fs.writeFile("test/reports/" + this.outputFileName_ + "_" +
(new Date()).getTime() +".json", JSON.stringify(this.output_),
doneCallback);
}
},
}