FSPlugin development

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

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

FSPlugin development

Post by *fabiochelly »

I try to create my first FS plugin.

Does any one know if it is possible to prevent the user to copy folders ? (I would like to authorize file copy only)
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
soreno
Junior Member
Junior Member
Posts: 87
Joined: 2003-02-13, 13:04 UTC
Location: Denmark

Post by *soreno »

I don't know much about the plugininterface - but if your plugin get a filename for each entry selected by the user, you could manually check the file in your plugin.

Code: Select all

callback function that responds to copy command(..)
{
  FileDataType = openFile(..);
  if(FileDataType->isDirectory())
  {
    //don't copy - perhaps warn the user ?
  }
  else
  {
    doStuff();
  }
}
Actual implementation depends on language.. :D
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

The problem is that I can't block the copy before it starts.
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes you can! Implement the function FsStatusInfo. When it is called with FS_STATUS_START and FS_STATUS_OP_GET_MULTI, TC will start a download operation from your plugin. Now set a flag (e.g. incopy=TRUE), and if it is set, return 'no more files' when TC calls FsFindFirst! This prevents TC from listing subdirs during copy, and this way it cannot copy them. Don't forget to clear the flag on receiving FS_STATUS_END notification!
Author of Total Commander
https://www.ghisler.com
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

Thanks, it works fine.
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

Well, it works for the copy, but this method don't work for a FS_STATUS_OP_CALCSIZE.
I get an error (it seems to call findfirst many times then return an error)
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
André Martin
Senior Member
Senior Member
Posts: 245
Joined: 2003-02-05, 15:46 UTC
Location: Dresden, Germany

Post by *André Martin »

Just handle FS_STATUS_OP_CALCSIZE in the same way as Christian it described it with the copy process (set a flag and when FNC is called return an invalid pointer and SetLastError to"no more files"...)
Browse the web with the HTTP SmartBrowserPlugin
Check your mails with the POP3/SMTP EmailPlugin!
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

That's exactly what I've done but if it works fine for a folder copy, I didn't get the same results for the CALCSIZE of a folder.
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

Thanks to everyone, I found where was the problem: I need to do the memset 0 to FindData even if I return an ERROR_NO_MORE_FILES
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
Post Reply