1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-26 19:47:20 +00:00

Use a JSON tiddler for $:/config/OriginalTiddlerPaths

Otherwise things go wrong when we have tiddler titles containing colons
This commit is contained in:
Jermolene 2014-08-20 10:11:40 +01:00
parent 1075bd2084
commit c912fed55d

View File

@ -1593,11 +1593,11 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
// Save the original tiddler file locations if requested // Save the original tiddler file locations if requested
var config = wikiInfo.config || {}; var config = wikiInfo.config || {};
if(config["retain-original-tiddler-path"]) { if(config["retain-original-tiddler-path"]) {
var output = []; var output = {};
for(var title in $tw.boot.files) { for(var title in $tw.boot.files) {
output.push(title + ": " + path.relative(resolvedWikiPath,$tw.boot.files[title].filepath) + "\n"); output[title] = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath);
} }
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/x-tiddler-dictionary", text: output.join("")}); $tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
} }
// Save the path to the tiddlers folder for the filesystemadaptor // Save the path to the tiddlers folder for the filesystemadaptor
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir); $tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir);