Change to Physical Directory from a FileSystem Plugin Folder

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
MayorA
Junior Member
Junior Member
Posts: 50
Joined: 2005-07-30, 18:11 UTC
Location: Switzerland

Change to Physical Directory from a FileSystem Plugin Folder

Post by *MayorA »

I am currently writing a new filesystem plugin interfacing the Windows Desktop Search API.
I stumbled over a minor issue, for which I have not yet found a simple solution:

How can I change to a physical folder (like C:\Windows) if a user changes into a virtual plugin folder (like \\\myPlugin\folder1) of a FileSystem Plugin.

For files function FsExecuteFile() gets called, which would allow to work with the FS_EXEC_SYMLINK mode. But for folders only FsFindFirst() gets called.

I experimented with code like that:

Code: Select all

writeClipboardText(item->Folder.c_str());
SendMessage( GetActiveWindow(), WM_USER+51, cm_EditPath, 0 );
SendMessage( GetActiveWindow(), WM_USER+51, cm_PasteFromClipboard, 0 );
SendMessage( GetActiveWindow(), WM_CHAR, 13, 0 );
which however did not work as expected.

Has anybody found a solution for that issue ?
CVSBrowser WFX Plugin Author
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

How can I change to a physical folder (like C:\Windows) if a user changes into a virtual plugin folder (like \\\myPlugin\folder1) of a FileSystem Plugin.
You actually want to use \\\myPlugin\folder1 as link to some real folder so you have to declare it not as FS-plugin folder but rather as FS-plugin file.
User avatar
MayorA
Junior Member
Junior Member
Posts: 50
Joined: 2005-07-30, 18:11 UTC
Location: Switzerland

Post by *MayorA »

VadiMGP wrote:You actually want to use \\\myPlugin\folder1 as link to some real folder so you have to declare it not as FS-plugin folder but rather as FS-plugin file.
Thanks for the answer.
I actually also thought about that solution, but it didn't seem to me the proper approach.
However maybe you are right and this is the simplest solution. I would then have to implement FsExtractCustomIcon() for folder icons.
CVSBrowser WFX Plugin Author
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed folders in FS plugins are just seen as containers for files by Total Commander, so it will just browse them and not call FsExecuteFile for them. Links must be files.
Author of Total Commander
https://www.ghisler.com
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

it didn't seem to me the proper approach.
It is depend on point of view. Think about the following question: Is folder1 really folder in terms of myPlugin? If it is folder in your file system - how user can see its content? If folder1 doesn't contain items in terms of your file system why you call it "folder"? :wink:
User avatar
MayorA
Junior Member
Junior Member
Posts: 50
Joined: 2005-07-30, 18:11 UTC
Location: Switzerland

Post by *MayorA »

As I mentioned before, the plugin I am currently developing will provide the results of a (full text) search. I wanted to represent the physical directories returned as search results as plugin folders. And once the user changes into such a plugin folder, he would be redirected to the corresponding physical directory.

I already implemented the folders as files, which works like a charm, with one drawback: the folders now are not separated from the files in the sort order ...
CVSBrowser WFX Plugin Author
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

one drawback: the folders now are not separated from the files in the sort order ...
Yes, it is inconvenience. You can try to implement own custom view for your plugin and introduce column File/Folder.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

MayorA wrote:As I mentioned before, the plugin I am currently developing will provide the results of a (full text) search. I wanted to represent the physical directories returned as search results as plugin folders. And once the user changes into such a plugin folder, he would be redirected to the corresponding physical directory.

I already implemented the folders as files, which works like a charm, with one drawback: the folders now are not separated from the files in the sort order ...
There's another solution. Very dirty, but should do the trick. Send TC "cd your_path" message in FsFindFirst, when you need to get out of your plugin.
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

Send TC "cd your_path" message in FsFindFirst
I dont like this method. I tried to implement this approach in my FSE plugin. Sending CD command not necessary switchs TC to another directory(it can be dismounted dir or removed disk). So anyway you can discover yourself stucked in FS-folder in unexpected state.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I also don't recommend that approach.

Better give the links names starting with a special character like ! or _ to separate them from files (when sorted by name).
Author of Total Commander
https://www.ghisler.com
Post Reply