diff options
author | Klaas Freitag <freitag@owncloud.com> | 2015-10-26 16:24:05 +0300 |
---|---|---|
committer | Klaas Freitag <freitag@owncloud.com> | 2015-10-26 16:24:05 +0300 |
commit | 6b712733803dde23f416bee8699ae1cb02ec7c8a (patch) | |
tree | 4df0d6bdc3a58e645c6df2728f4384426b3a5b6f /csync | |
parent | b5390b5aa2d66fd310b57760b8db4718f1767d97 (diff) |
Discovery: Fix detection of hidden files.
In the discovery phase we want to detect that dot-files are hidden
on Linux and Mac.
This fixes strange behaviour seen in issue #3980
Diffstat (limited to 'csync')
-rw-r--r-- | csync/src/csync_update.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index 99570c232..49546d52b 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -688,8 +688,8 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn, } /* 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; @@ -748,6 +748,16 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn, 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: |