FsGetFile
FsGetFile is called to transfer a file from the plugin's file system to the normal file system (drive letters or UNC).
Declaration:
int __stdcall FsGetFile(char* RemoteName, char* LocalName, int CopyFlags, RemoteInfoStruct* ri);
Description of parameters:
RemoteName Name of the file to be retrieved, with full path. The name always starts with a backslash, then the names returned by FsFindFirst/FsFindNext separated by backslashes.
LocalName Local file name with full path, either with a drive letter or UNC path (\\Server\Share\filename). The plugin may change the NAME/EXTENSION of the file (e.g. when file conversion is done), but not the path!
CopyFlags Can be a combination of the following three flags:
FS_COPYFLAGS_OVERWRITE: If set, overwrite any existing file without asking. If not set, simply fail copying.
FS_COPYFLAGS_RESUME: Resume an aborted or failed transfer.
FS_COPYFLAGS_MOVE: The plugin needs to delete the remote file after uploading
See below for important notes!
ri This parameter contains information about the remote file which was previously retrieved via FsFindFirst/FsFindNext: The size, date/time, and attributes of the remote file. May be useful to copy the attributes with the file, and for displaying a progress dialog.
Return value:
Return one of the following values:
FS_FILE_OK The file was copied OK
FS_FILE_EXISTS The local file already exists, and resume isn't supported
FS_FILE_NOTFOUND The remote file couldn't be found or opened.
FS_FILE_READERROR There was an error reading from the remote file
FS_FILE_WRITEERROR There was an error writing to the local file, e.g. disk full
FS_FILE_USERABORT Copying was aborted by the user (through ProgressProc)
FS_FILE_NOTSUPPORTED The operation is not supported (e.g. resume)
FS_FILE_EXISTSRESUMEALLOWED The local file already exists, and resume is supported
Important notes
Total Commander usually calls this function twice:
- once with CopyFlags==0 or CopyFlags==FS_COPYFLAGS_MOVE. If the local file exists and resume is supported, return FS_FILE_EXISTSRESUMEALLOWED. If resume isn't allowed, return FS_FILE_EXISTS
- a second time with FS_COPYFLAGS_RESUME or FS_COPYFLAGS_OVERWRITE, depending on the user's choice. The resume option is only offered to the user if FS_FILE_EXISTSRESUMEALLOWED was returned by the first call.
- FS_COPYFLAGS_EXISTS_SAMECASE and FS_COPYFLAGS_EXISTS_DIFFERENTCASE are NEVER passed to this function, because the plugin can easily determine whether a local file exists or not.
- FS_COPYFLAGS_MOVE is set, the plugin needs to delete the remote file after a successful download.
While copying the file, but at least at the beginning and the end, call ProgressProc to show the copy progress and allow the user to abort the operation.