2024-05-09 23:23 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbapifs.h
  * src/rtl/fscopy.c
    + added new C function:
         HB_BOOL hb_fileCopyEx( const char * pszSource, const char * pszDest,
                                HB_SIZE nBufSize, HB_BOOL fTime,
                                PHB_ITEM pCallBack );
      Unlike hb_fileCopy() it is never redirected to remote server and copy
      operation is always done locally.
      pCallBack is codeblock or function symbol, it's executed at the
      beginning and then on each nBufSize bytes written and receives two
      parameters: nBytesWritten, nTotalSize.
      Warning: nTotalSize could be 0 when non regular files like pipes or
               sockets are copied.

  * src/rtl/vfile.c
    + added new PRG function:
         hb_vfCopyFile( <cFileSrc>, <cFileDst>, [<nBufSize>=65536], ;
                        [<lTimePreserve>=.t.], [<bCallBack>] ) --> <nResult>
      It's wrapper to hb_fileCopyEx() C function.
      For very big files setting <nBufSize> to greater value, i.e. 16777216
      may increase performance.
This commit is contained in:
Przemysław Czerpak
2024-05-09 23:23:26 +02:00
parent 371631dac4
commit 1c70367da5
4 changed files with 132 additions and 0 deletions

View File

@@ -415,6 +415,7 @@ extern HB_EXPORT HB_BOOL hb_fileDelete ( const char * pszFileName );
extern HB_EXPORT HB_BOOL hb_fileRename ( const char * pszFileName, const char * pszNewName );
extern HB_EXPORT HB_BOOL hb_fileCopy ( const char * pszSrcFile, const char * pszDstFile );
extern HB_EXPORT HB_BOOL hb_fileMove ( const char * pszSrcFile, const char * pszDstFile );
extern HB_EXPORT HB_BOOL hb_fileCopyEx ( const char * pszSource, const char * pszDest, HB_SIZE nBufSize, HB_BOOL fTime, PHB_ITEM pCallBack );
extern HB_EXPORT HB_BOOL hb_fileDirExists ( const char * pszDirName );
extern HB_EXPORT HB_BOOL hb_fileDirMake ( const char * pszDirName );