}
/* skip "." and ".." */
- if (d_name[0] == '.' && (d_name[1] == '\0'
- || (d_name[1] == '.' && d_name[2] == '\0'))) {
+ if ( (d_name[0] == '.' && d_name[1] == '\0')
+ || (d_name[0] == '.' && d_name[1] == '.' && d_name[2] == '\0')) {
csync_vio_file_stat_destroy(dirent);
dirent = NULL;
continue;
res = 0;
}
+ /* for non windows platforms, detect if the filename starts with a .
+ * and if so, it's a hidden file. For windows, the hidden state is
+ * discovered within the vio local stat function.
+ */
+#ifndef _WIN32
+ if( d_name[0] == '.' ) {
+ fs->flags |= CSYNC_VIO_FILE_FLAGS_HIDDEN;
+ }
+#endif
+
if( res == 0) {
switch (fs->type) {
case CSYNC_VIO_FILE_TYPE_SYMBOLIC_LINK:
if (!file_stat->etag || strlen(file_stat->etag) == 0) {
qDebug() << "WARNING: etag of" << file_stat->name << "is" << file_stat->etag << " This must not happen.";
}
- if( file.startsWith(QChar('.')) ) {
+
+ QStringRef fileRef(&file);
+ int slashPos = file.lastIndexOf(QLatin1Char('/'));
+ if( slashPos > -1 ) {
+ fileRef = fileRef.mid(slashPos+1);
+ }
+ if( fileRef.startsWith(QChar('.')) ) {
file_stat->flags = CSYNC_VIO_FILE_FLAGS_HIDDEN;
}
//qDebug() << "!!!!" << file_stat << file_stat->name << file_stat->file_id << map.count();