From 5a97ac5ea9e6b199b0cda7487c8f884270dbe440 Mon Sep 17 00:00:00 2001 From: jwang Date: Thu, 20 Jun 2013 16:44:06 +0800 Subject: [PATCH] Add timestamp for exported file Change-Id: I76cce8d163cf33b40b8693eaf537b6c84e115110 --- js/main.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/main.js b/js/main.js index f299646..c576f77 100755 --- a/js/main.js +++ b/js/main.js @@ -41,7 +41,7 @@ var mandatorylist = new Array( "multiTouchCount"); //var accMarks = {}; var noSupport = {}; -var resultFile = "tct-behavior-tests.result.xml"; +var resultFile = "tct-behavior-tests_" + getCurrentTime() + ".result.xml"; var tmpResultFile = "tct-behavior-tests.tmpresult.xml"; function updateToolTitle() { @@ -172,6 +172,11 @@ function closeWindow() { window.close(); } +function getCurrentTime() { + var d = new Date(); + return d.toISOString(); +} + function writeFile(filename, content, need_exit) { successCallback = function(fs) { fs.write(content); @@ -184,10 +189,10 @@ function writeFile(filename, content, need_exit) { exitTest(); }; + onsuccess = function(dir) { -// if (need_exit) -// dir.deleteFile(dir.fullPath + "/" + tmpResultFile); dir.deleteFile(dir.fullPath + "/" + filename); + file = dir.createFile(filename); file.openStream("rw", successCallback, onerror, "UTF-8"); }; @@ -325,7 +330,7 @@ function getCapPresent() { } function isCapPresent(name) { - if ((caps != undefined)&&(caps[name] != undefined)) { + if ((caps != undefined) && (caps[name] != undefined)) { if (typeof(caps[name]) == "boolean") return caps[name]; else @@ -336,7 +341,7 @@ function isCapPresent(name) { } function isCapMandatory(name) { - for (var i = 0;i < mandatorylist.length; i++) { + for (var i = 0; i < mandatorylist.length; i++) { if (mandatorylist[i] === name) return true; }; -- 2.7.4