diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-11-13 21:49:06 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-11-13 21:49:06 +0000 |
commit | 03adcc0fda221ca636b5fe71547cde0a0737161b (patch) | |
tree | c850a2256759b6a1a2c38922c1f6e3871ac4176e /winsup/cygwin/syscalls.cc | |
parent | 7a43fd8be112c2a94b3b7f06a28ce54ba931dbb2 (diff) | |
download | cygnal-03adcc0fda221ca636b5fe71547cde0a0737161b.tar.gz cygnal-03adcc0fda221ca636b5fe71547cde0a0737161b.tar.bz2 cygnal-03adcc0fda221ca636b5fe71547cde0a0737161b.zip |
* dir.cc (mkdir): Add HIDDEN file attribute if file has leading dot
and HIDDEN_DOT_FILES is defined.
* fhandler.cc (fhandler_base::open): Ditto.
* path.cc (symlink): Ditto.
* syscalls.cc (_rename): Ditto and remove HIDDEN file attribute if
new filename does not begin with a dot.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 3b2104d7f..307d61885 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1240,7 +1240,16 @@ done: else { /* make the new file have the permissions of the old one */ - SetFileAttributes (real_new, real_old); + DWORD attr = real_old; +#ifdef HIDDEN_DOT_FILES + char *c = strrchr (real_old.get_win32 (), '\\'); + if ((c && c[1] == '.') || *real_old.get_win32 () == '.') + attr &= ~FILE_ATTRIBUTE_HIDDEN; + c = strrchr (real_new.get_win32 (), '\\'); + if ((c && c[1] == '.') || *real_new.get_win32 () == '.') + attr |= FILE_ATTRIBUTE_HIDDEN; +#endif + SetFileAttributes (real_new, attr); /* Shortcut hack, No. 2, part 2 */ /* if the new filename was an existing shortcut, remove it now if the |