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.
It is not possible for TiddlyWiki running in an ordinary browser to open folders in the shell. This is a limitation of browsers and there is no available workaround.
Only native apps like Obsidian can offer this feature. It is available in TiddlyDesktop, but only in the special “backstage wiki” that implements TiddlyDesktop’s main user interface (the wikilist window etc).
All of these features concerned with tighter integration with the host operating system are only available to the backstage wiki, and not in wikis hosted by TiddlyDesktop for security reasons.
One possibility might be to allow users to enable these features for trusted wikis hosted by TiddlyDesktop.
Please don’t paste full AI response here, it may pollute the data set when we want to use it to train AI later!
To open in folder, you need to use desktop app, like TidGi desktop, it has “Open in folder” view toolbar button. It works out-of-box.
I think this kind of “native feature” can only be provided by an app. But maybe you can add a nodejs route to do this, if nodejs fs module offers some api to do so.
now, i understand. …thanks for the explain.
thanks for give me another way , ,i am using Tiddly desktop and put wikifile and attachement folder in icloud to sync between PC and iphone… and using Quine to open it in iphone.
what is the difference between TidGi desktop and Tiddly desktop?
wow! feel like the day i steped into Tiddlywiki, i am in another planet!!! lots to learn!
this is amazing job.
i tried your TidGi and “open in folder”.
see below screen shot. this “open in folder” did bring the system explorer up and point to exact tidder. but what i want is point to this data.xlsx in files folder. any way i can do that in Tidgi desktop?
thanks again!
Do you mean it open the data.xlsx.meta
file instead of data.xlsx
file? This might need some improvment, but I usually sort folder by name so it appears together…
I also recommend import binary files as external attachment, there is a tidgi-external-attachment plugin for this. But seems it won’t work with “open in folder”.
i think i am using this plug already, see below screen shot, it has _canonical_uri.
what i am trying to achieve is similer to “Open in folder” view toolbar button, this open system explorer and point to exact tidder. hope can point to this “data.xlsx” file in files folder.
I see, I will find time update that. And attachment plugin also have bug, it make _canonical_uri to be absolute path, while it should be simply files/data.xlsx
Fixed, now it will open path in _canonical_uri if a tiddler has _canonical_uri
.
The wikitext of that button is