diff --git a/boot/boot.js b/boot/boot.js index 4ad0b7722..69901df5b 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1465,6 +1465,7 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) { if(files.indexOf("tiddlywiki.files") !== -1) { // If so, process the files it describes var filesInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8")); + // First the tiddlers $tw.utils.each(filesInfo.tiddlers,function(tidInfo) { var type = tidInfo.fields.type || "text/plain", typeInfo = $tw.config.contentTypeInfo[type], @@ -1493,6 +1494,13 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) { tiddlers.push({tiddlers: [tidInfo.fields]}); } }); + // Then any recursive directories + $tw.utils.each(filesInfo.directories,function(dirPath) { + var pathname = path.resolve(filepath,dirPath); + if(fs.existsSync(pathname) && fs.statSync(pathname).isDirectory()) { + tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(pathname,excludeRegExp)); + } + }); } else { // If not, read all the files in the directory $tw.utils.each(files,function(file) { diff --git a/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid b/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid index 2afc5cadc..2b846b0d5 100644 --- a/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid +++ b/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid @@ -106,6 +106,9 @@ Sub-folders within the `tiddlers` folder can also be given a `tiddlywiki.files` "title": "A different title" } } + ], + "directories": [ + "../../mytiddlers/store" ] } ``` @@ -117,3 +120,5 @@ The JSON data consists of an object with a `tiddlers` property that contains an ** `isTiddlerFile`: if `true`, the file will be deserialised to extract the tiddlers. Otherwise, the raw content of the file is assigned to the `text` field without any parsing * `fields`: an object containing fields that override any provided in the tiddler file * `prefix` & `suffix`: (optional) specify strings to be prefixed and suffixed to the tiddler file text content + +The ''directories'' property allows a list of directories to be specified. All tiddlers will be recursively loaded from each directory listed.