From 9141cf5d18be30cd2e323b37969876de1ed3533e Mon Sep 17 00:00:00 2001 From: "Nicolab.net" Date: Sat, 13 Dec 2014 12:45:49 +0100 Subject: [PATCH] [view] use locale time and change revision format --- lib/local-history-view.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/local-history-view.js b/lib/local-history-view.js index 2099c1f..5cc2d00 100644 --- a/lib/local-history-view.js +++ b/lib/local-history-view.js @@ -172,23 +172,24 @@ LocalHistoryView.prototype.openDifftool = function openDifftool(current, revisio }; LocalHistoryView.prototype.saveRevision = function saveRevision(buffer) { - var now, pathDirName, file; + var now, pathDirName, file, revFileName; now = new Date(); pathDirName = path.dirname(buffer.file.path); + // YYYY-mm-dd_HH-ii-ss_basename + revFileName = now.getFullYear() + + '-' + (now.getMonth() + 1) + + '-' + now.getDate() + + '_' + now.toLocaleTimeString().replace(/:/g, '-') + + '_' + path.basename(buffer.file.path) + ; + if(process.platform === 'win32') { pathDirName = pathDirName.replace(/:/g,''); } - file = path.join( - localHistoryPath, - pathDirName, - - // YYYY-mm-dd.HH.ii.ss.basename - now.toISOString().replace(/^(\d{4}\-\d{2}\-\d{2}).(\d{2})\:(\d{2})\:(\d{2}).*$/, - '$1_$2.$3.$4.') + path.basename(buffer.file.path) - ); + file = path.join(localHistoryPath, pathDirName, revFileName); fsPlus.writeFile(file, buffer.cachedDiskContents, function(err) { var messages;