* 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.
This commit is contained in:
Corinna Vinschen
2001-11-13 21:49:06 +00:00
parent 7a43fd8be1
commit 03adcc0fda
5 changed files with 45 additions and 6 deletions

View File

@@ -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