Sync adapter with support for subfolder structure according to hierarchical tiddler titles

In order to better organize my TW5 customizations I don't want all my tiddlers to be thrown flat inside a single folder as the filesystemadaptor.js sync adapter currently does. All I wanted was to see a similar tiddler organization into subfolders as the TiddlyWiki5 repository uses. Unfortunately, no luck here so far, so I had to get into core hacking territory, combined with anonymous scopes, asynchronous control flow, and Node.js. Shiver... :)

Luckily, I was able to rather quickly hack up Jeremy's sync adapter filesystemadaptor.js into a new version that now supports storing tiddlers in a subfolder structure according to hierarchical tiddler titles. This plugin also understands $:/ to indicate system tiddlers and puts them into their dedicated "system" folder. Draft tiddlers are handled specially too: they are stored flat inside their (hidden) ".drafts" folder.

Subfolder creation works fully asynchronous; I've thrown in my own "mkdir -p" function mkdirp, so no need to rely on optional Node.js modules.

The names of the special folders "system" and ".drafts" can be configured -- albeit only in the source code at this time. Maybe we see plugin-specific additional options during boot in the future?

I didn't dare to directly hack the existing filesystemadaptor.js but instead decided to copy and enhance its code. While we surely want to have code sharing in the future I decided to do a standalone sync adapter at this time. Jeremy will surely know what to do with my new code.

So ... enjoy the hierarchical tiddler storage ... much better organized in my repos now.
-- TheDiveO
I'm not sure what you mean here? The best way to pass per-wiki configuration to the filesystem adaptor is in the wiki `tiddlywiki.info` file.