mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Trap missing tiddlers in savetiddler command
This commit is contained in:
parent
4764c456ca
commit
bdd5aa9343
@ -32,13 +32,17 @@ Command.prototype.execute = function() {
|
|||||||
path = require("path"),
|
path = require("path"),
|
||||||
title = this.params[0],
|
title = this.params[0],
|
||||||
filename = path.resolve(this.commander.outputPath,this.params[1]),
|
filename = path.resolve(this.commander.outputPath,this.params[1]),
|
||||||
tiddler = this.commander.wiki.getTiddler(title),
|
tiddler = this.commander.wiki.getTiddler(title);
|
||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
if(tiddler) {
|
||||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"};
|
var type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
$tw.utils.createFileDirectories(filename);
|
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"};
|
||||||
fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {
|
$tw.utils.createFileDirectories(filename);
|
||||||
self.callback(err);
|
fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {
|
||||||
});
|
self.callback(err);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return "Missing tiddler: " + title;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user