The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

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
jaco777
Junior Member
Junior Member
Posts: 19
Joined: 2015-03-23, 21:56 UTC
Location: Poland
Contact:

The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

Post by *jaco777 »

Hello.

I wrote a WFX plugin for cloud internet disk support - for my own needs.

But in <Synchronize directories> the check box <by content> work does the opposite.
When check box <by content> is checked, synchronization does not download the internal content of files and does not compare them.
When check box <by content> is unchecked, synchronization download the internal content of files and compare them.

Did I miss anything while writing the plugin in any function?

I was based on the source code of this plugin in Deplhi: HTTP browser 1.0.4 http://ghisler.fileburst.com/fsplugins/hbrowser_source.zip
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

Post by *ghisler(Author) »

This makes no sense - file system plugins don't support compare by content, and files don't get downloaded.

There is an inofficial not yet documented set of functions which can ask the file system plugin for a checksum - many cloud services report a cecksum.
My SFTP plugin supports this method, you can check the sources.
Have a look at sftpplug.cpp, the functions:
int __stdcall FsServerSupportsChecksumsW(WCHAR* RemoteName)
int __stdcall FsServerSupportsChecksums(char* RemoteName)
HANDLE __stdcall FsStartFileChecksumW(int ChecksumType,WCHAR* RemoteName)
HANDLE __stdcall FsStartFileChecksum(int ChecksumType,char* RemoteName)
int __stdcall FsGetFileChecksumResultW(BOOL WantResult,HANDLE ChecksumHandle,WCHAR* RemoteName,char* checksum,int maxlen)
int __stdcall FsGetFileChecksumResult(BOOL WantResult,HANDLE ChecksumHandle,char* RemoteName, char* checksum,int maxlen)

Christian Ghisler
Author of Total Commander
https://www.ghisler.com
megaboy2k
Junior Member
Junior Member
Posts: 5
Joined: 2021-10-25, 00:24 UTC

Re: The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

Post by *megaboy2k »

Hi ghisler,

Starting which version TC supports this inofficial set of functions?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

Post by *Dalai »

megaboy2k wrote: 2021-10-25, 00:26 UTCStarting which version TC supports this inofficial set of functions?
Searching through totalcmd*.exe files of the last half dozen of releases shows version 9.10 is the first to have these functions.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
megaboy2k
Junior Member
Junior Member
Posts: 5
Joined: 2021-10-25, 00:24 UTC

Re: The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

Post by *megaboy2k »

Thanks Dalai,

Just checked TC10 with SFTP plugin 2.80 and now <Synchronize directories> compares files by content as expected!
megaboy2k
Junior Member
Junior Member
Posts: 5
Joined: 2021-10-25, 00:24 UTC

Re: The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

Post by *megaboy2k »

One more observation.
File comparision with <Synchronize directories> works correctly only if line endings on both sides are identical.
This can be achived by setting Binary transfer mode for even text files, e.g. source code cpp, h, etc.
Otherwise it will apply coversion based on plugin setting. Moreover, this conversion has pretty unlear logic. If it is set to Unix system then
the plugin will convert line endings to Windows style. If it is set to Windows system it stops converting it at all (LF and CR/LF are both accesible).
I am actually in doubt wich way is more accurate, is it using binary mode always or to set Windows system in plugin settings.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: The check box <by content> in <Synchronize directories> does the opposite in my WFX plugin

Post by *ghisler(Author) »

If you set the mode to Windows system, it's assumed that the remote system is a Windows device, and the local too. Therefore no conversion is needed. If you set it to Unix, then a conversion is needed both on upload and download.
Author of Total Commander
https://www.ghisler.com
Post Reply