*
* @param path the name of the subdir to create
*/
-void ReDirSync::makeDirWithParents(const ReByteBuffer& path, int minWidth,
+void ReDirSync::makeDirWithParents(ReByteBuffer& path, int minWidth,
ReTraverser& traverser){
struct stat info;
+ bool endsWithSlash = path.str()[path.length() - 1] == OS_SEPARATOR_CHAR;
+ if (endsWithSlash)
+ path.setLength(path.length() - 1);
if (stat(path.str(), &info) != 0){
ReFileProperties_t* props = NULL;
#if defined __linux__
#endif
makeDirectory(path.str(), minWidth, props, ReLogger::globalLogger());
}
+ if (endsWithSlash)
+ path.append(OS_SEPARATOR, 1);
}
/**
* Constructor.
fclose(fpSource);
}
#elif defined __WIN32__
- BOOL dummy;
- rc = CopyFileExA(source, target, NULL, NULL, &dummy, COPY_FILE_NO_BUFFERING) != 0;
+ BOOL cancel = false;
+ rc = CopyFileExA(source, target, NULL, NULL, &cancel, COPY_FILE_NO_BUFFERING) != 0;
int errNo = 0;
if (! rc)
errNo = GetLastError();
continue;
}
// target younger than source?
+ int diff = info.st_mtime - entry->filetimeToTime(entry->modified());
if (! ignoreDate && info.st_mtime - entry->filetimeToTime(entry->modified())
- > maxFileTimeDiff) {
+ <= maxFileTimeDiff) {
if (chatterMode)
fprintf(m_output, "=ignored: %s same time\n", targetRelativePath);
continue;
if (verbose){
int duration = int(time(NULL) - start);
fprintf(m_output, i18n(
- "=== copied: %d file(s) with %.6f MByte in %02d:%02d sec. Tree: %d dir(s) %d file(s) %.6f MByte\n"),
- files, sumSizes / 1E6, duration / 60, duration % 60,
+ "=== copied: %02d:%02d sec %7d file(s) %12.6f MByte (%.3f MB/sec).\n"
+ "=== tree : %5d dir(s) %7d file(s) %12.6f MByte\n"),
+ duration / 60, duration % 60, files, sumSizes / 1E6,
+ sumSizes / 1E6 / (duration == 0 ? 1 : duration),
treeDirs, treeFiles, treeSumSizes / 1E6);
}
} catch(ReOptionException& exc){
void synchronize(int argc, const char* argv[]);
protected:
void copyFile(ReDirStatus_t* entry, const char* target);
- void makeDirWithParents(const ReByteBuffer& path, int minWidth,
+ void makeDirWithParents(ReByteBuffer& path, int minWidth,
ReTraverser& traverser);
public:
static bool copyFile(const char* source, ReFileProperties_t* properties,