in Obsidian, when you right click a ralative path , you have option to “Show in system explorer”
i used “attachedment plugin” to generate _canonical_uri: tiddlyer with relative patch, is there any way in TW to mirror this Obsidian function?
in Obsidian, when you right click a ralative path , you have option to “Show in system explorer”
i used “attachedment plugin” to generate _canonical_uri: tiddlyer with relative patch, is there any way in TW to mirror this Obsidian function?
this is what i got from Grok3, feel like so close to the solution, but still not working for me.
To replicate Obsidian’s “Show in System Explorer” function with relative paths in TiddlyWiki Desktop (TiddlyDesktop), create a custom JavaScript tiddler to handle folder opening and add a button to trigger it.
This works by resolving the relative path to an absolute folder path and using system commands to open it in the explorer.
It requires TiddlyDesktop, not browser-based TiddlyWiki, due to security restrictions.
Name the tiddler $:/scripts/openFolder and set its type to application/javascript.
Add the following code to handle opening the folder:
(function() {
var openFolder = function(event) {
var relativePath = event.param;
var wikiUrl = window.location.href;
var wikiPath = require('url').fileURLToPath(wikiUrl);
var wikiDir = require('path').dirname(wikiPath);
var absolutePath = require('path').join(wikiDir, relativePath);
var folderPath;
if (relativePath.endsWith('/')) {
folderPath = absolutePath;
} else {
folderPath = require('path').dirname(absolutePath);
}
var nw = require('nw.gui');
nw.Shell.openItem(folderPath);
};
$tw.hooks.addHook("th-message", function(event) {
if(event.message === "openFolder") {
openFolder(event);
}
});
})();
In the tiddler where you want to open the folder (e.g., MyFileLink), add a field file-path with the relative path, like files/example.pdf.
Add a button to trigger the folder opening:
title: MyFileLink
file-path: files/example.pdf
This is a link to a file: {{!!file-path}}
<$button>Open Folder
<$action-sendmessage $message="openFolder" $param={{!!file-path}}/>
</$button>
When clicked, this button sends the openFolder message with the relative path, and the JavaScript tiddler handles opening the folder in your system explorer.
@jeremyruston … Will AI created code like this work in TiddlyDesktop? I know it does not work with the browser, but I do not know if TD allows commands like var wikiDir = require('path').dirname(wikiPath);
am not sure as well. hope some one have a solution for this. it is a very nice feature in Obsidian, hope can replicate here in Tiddlywiki.