From 1bba9dc3158ba9943c05597b49257c3f1f163c4b Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 14 Dec 2016 09:54:50 +0000 Subject: [PATCH] Reuse $tw.loadTiddlersFromPath() in --load command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thus allowing things like tiddlywiki.files to be used with the —load command --- core/modules/commands/load.js | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/core/modules/commands/load.js b/core/modules/commands/load.js index 95cee01be..62cf7500c 100644 --- a/core/modules/commands/load.js +++ b/core/modules/commands/load.js @@ -30,24 +30,21 @@ Command.prototype.execute = function() { if(this.params.length < 1) { return "Missing filename"; } - var ext = path.extname(self.params[0]); - fs.readFile(this.params[0],$tw.utils.getTypeEncoding(ext),function(err,data) { - if (err) { - self.callback(err); - } else { - var fields = {title: self.params[0]}, - type = path.extname(self.params[0]); - var tiddlers = self.commander.wiki.deserializeTiddlers(type,data,fields); - if(!tiddlers) { - self.callback("No tiddlers found in file \"" + self.params[0] + "\""); - } else { - for(var t=0; t