In prototyping yesterday's blogged idea with .vtb / .mrr files, I've run into some design flaws with the proposed "schema". Main problem among them is that directory structures are typically not described in flat lists but as <ul> trees. A local file name should not be described as
<li>dir</li>
<li>dir/subdir</li>
<li>dir/subdir/file.ext</li>
.. but rather as..
<ul class="mrrdir">
<li>dir
<ul>
<li class="mrrdir">subdir
<ul>
<li class="mrrfile">file</li>
</ul></li>
</ul>
</li>
</ul>
This makes more sense because it when it is rendered in HTML it is more legible and maintainable in the DOM.
Imagine if this was "fuzzy" and not strict. If the filename could be "subsubdir/file.ext", or worse "C:/windows/system32/file.ext", you run into all sorts of problems trying to target the download destination path. Directory seperators are completely disallowed, then, in the text value of the file's <li> entity.
This changes the programming a bit on the Windows app side, in both easier and more difficult ways. It becomes easier to manage the directories, but now the files' download names have to be managed within the directories virtually. Note that by "difficult" I mean a few extra minutes, not a few extra hours; on the other hand, thinking this through, I've already lost a few hours and decided to start over in my code while it's still a brand new and barely written prototype codebase.
Meanwhile, the href value must assume that the base URI is always the base URI for the entire document, not for the listed directory.
Here's a proposed valid sample .mrr doc, where the base URI is: http://cachefile.net/
<ul class="mrr">
<li class="mrrdir">
<a href="scripts">scripts</a>
<ul class="mrrdir">
<li class="mrrdir">
<a href="scripts/jquery">jquery</a>
<ul class="mrrdir">
<li class="mrrdir">
<a href="scripts/jquery/1.2.1">1.2.1</a>
<ul class="mrrdir">
<li class="mrrfile">
<a href="scripts/jquery/1.2.1/jquery-1.2.1.js">jquery-1.2.1.js</a>
</li>
<li class="mrrfile">
<a href="scripts/jquery/1.2.1/jquery-1.2.1.min.js">jquery-1.2.1.js</a>
</li>
<li class="mrrfile">
<a href="scripts/jquery/1.2.1/jquery-1.2.1.pack.js">jquery-1.2.1.pack.js</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
Rendered in plain HTML:
I'll update this post with a revised Windows app (C#) prototype soon.