checkSetFilterFromProgramArgs();
testDirStatistic();
testBasic();
+ testCopyFile();
}
+ void testCopyFile(){
+ ReByteBuffer src(m_base);
+ src.append("dir1/dir1_2/dir1_2_1/x1.txt");
+ ReByteBuffer trg(getTestDir());
+ trg.append("copy_x1.txt");
+ ReByteBuffer buffer;
+ ReDirSync::copyFile(src.str(), 0, -1ll, trg.str(), buffer, ReLogger::globalLogger());
+ }
void checkRelDate(time_t absTime, int relTime){
int diff = int(time(NULL) - relTime - absTime);
if (diff < 0)
ReDirOptions(s_syncUsage, s_syncExamples),
m_buffer()
{
- m_buffer.ensureSize(4u*1024*1024*1024);
+ m_buffer.ensureSize(4u*1024u*1024u);
m_programArgs.addBool("add",
i18n("copies only files which does not exist on the target"),
'a', "add", false);
bool ReDirSync::copyFile(const char* source, time_t modified, int64_t size,
const char* target, ReByteBuffer& buffer, ReLogger* logger){
bool rc = false;
+#ifdef __linux__
if (size < 0ll){
struct stat info;
if (stat(source, &info) == 0)
fclose(fpSource);
}
}
+#elif defined __WIN32__
+ BOOL dummy;
+ rc = CopyFileEx(source, target, NULL, NULL, &dummy, COPY_FILE_NO_BUFFERING) != 0;
+#endif
return rc;
}
/**