[RFC] File paths for tw-com edition
discussion
The [file-paths issue](https://talk.tiddlywiki.org/t/file-paths-for-tw-com-edition/1504) has long bugged me when it comes back from time to time if it causes problems for me personally.
It currently causes a problem with the tw-mcp server token limits. The [$:/config/OriginalTiddlerPaths](https://tiddlywiki.com/#%24%3A%2Fconfig%2FOriginalTiddlerPaths) tiddler is 123kByte in size, only to allow us to save tiddlers back to where they came from. Worst - This tiddler is saved to tw-com, where it only wastes space.
But it does not cover new tiddlers and also causes problems with https://edit.tiddlywiki.com/ if it creates new tiddlers.
While experimenting with configurations in `$:/config/FileSystemPaths`, I found out, that some **system tiddler** namespaces are very close to the Windows file path limit of 260 characters.
The "worst offender" is a possible tiddler mentioned at: https://tiddlywiki.com/prerelease/#WebServer%20API%3A%20Get%20All%20Tiddlers
The tiddler mentioned there will create a path that Windows can not handle. It will be 302 minimum.
For tiddler filenames we also have to take the user work-directory into account, that adds to the length. eg: My working directory is `X:/git/tiddy/tiddlywiki/tiddlywiki5/` .. Which already needs 36 characters, which we have to add. So we my use 50 characters overhead as a default.
It is possible to shorten paths that a tiddler title creates, but the filter string is enormous and very complex.
I would like to create new filter operator `shorten[threshold],[prefix]`, that is fast eg: `{{{ [<input>removeprefix[$:/config/]shorten[150],[_config]] }}}` where 150 is the threshold where the operator starts to shorten the link in this format: `<prefix>/<s1>/<s2>/<sha256[10]>/<fileName>`
@Jermolene @saqimtiaz ... What do you think.
6 条评论