* 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:
		| @@ -1,3 +1,12 @@ | |||||||
|  | 2001-11-13  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* 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. | ||||||
|  |  | ||||||
| 2001-11-12  Christopher Faylor  <cgf@redhat.com> | 2001-11-12  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
| 	* fhandler_console.cc (fhandler_console::read): Revert 2001-10-23 | 	* fhandler_console.cc (fhandler_console::read): Revert 2001-10-23 | ||||||
|   | |||||||
| @@ -340,6 +340,11 @@ mkdir (const char *dir, mode_t mode) | |||||||
|       if (!allow_ntsec && allow_ntea) |       if (!allow_ntsec && allow_ntea) | ||||||
| 	set_file_attribute (real_dir.has_acls (), real_dir.get_win32 (), | 	set_file_attribute (real_dir.has_acls (), real_dir.get_win32 (), | ||||||
| 			    S_IFDIR | ((mode & 07777) & ~cygheap->umask)); | 			    S_IFDIR | ((mode & 07777) & ~cygheap->umask)); | ||||||
|  | #ifdef HIDDEN_DOT_FILES | ||||||
|  |       char *c = strrchr (real_dir.get_win32 (), '\\'); | ||||||
|  |       if ((c && c[1] == '.') || *real_dir.get_win32 () == '.') | ||||||
|  |         SetFileAttributes (real_dir.get_win32 (), FILE_ATTRIBUTE_HIDDEN); | ||||||
|  | #endif | ||||||
|       res = 0; |       res = 0; | ||||||
|     } |     } | ||||||
|   else |   else | ||||||
|   | |||||||
| @@ -371,6 +371,15 @@ fhandler_base::open (path_conv *, int flags, mode_t mode) | |||||||
|   if (get_device () == FH_SERIAL) |   if (get_device () == FH_SERIAL) | ||||||
|     file_attributes |= FILE_FLAG_OVERLAPPED; |     file_attributes |= FILE_FLAG_OVERLAPPED; | ||||||
|  |  | ||||||
|  | #ifdef HIDDEN_DOT_FILES | ||||||
|  |   if (flags & O_CREAT && get_device () == FH_DISK) | ||||||
|  |     { | ||||||
|  |       char *c = strrchr (get_win32_name (), '\\'); | ||||||
|  |       if ((c && c[1] == '.') || *get_win32_name () == '.') | ||||||
|  |         file_attributes |= FILE_ATTRIBUTE_HIDDEN; | ||||||
|  |     } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   /* CreateFile() with dwDesiredAccess == 0 when called on remote |   /* CreateFile() with dwDesiredAccess == 0 when called on remote | ||||||
|      share returns some handle, even if file doesn't exist. This code |      share returns some handle, even if file doesn't exist. This code | ||||||
|      works around this bug. */ |      works around this bug. */ | ||||||
|   | |||||||
| @@ -2651,9 +2651,16 @@ symlink (const char *topath, const char *frompath) | |||||||
| 	    set_file_attribute (win32_path.has_acls (), | 	    set_file_attribute (win32_path.has_acls (), | ||||||
| 				win32_path.get_win32 (), | 				win32_path.get_win32 (), | ||||||
| 				S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO); | 				S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO); | ||||||
| 	  SetFileAttributesA (win32_path.get_win32 (), |  | ||||||
| 			      allow_winsymlinks ? FILE_ATTRIBUTE_READONLY | 	  DWORD attr = allow_winsymlinks ? FILE_ATTRIBUTE_READONLY | ||||||
| 						: FILE_ATTRIBUTE_SYSTEM); | 	  				 : FILE_ATTRIBUTE_SYSTEM; | ||||||
|  | #ifdef HIDDEN_DOT_FILES | ||||||
|  | 	  cp = strrchr (win32_path, '\\'); | ||||||
|  | 	  if ((cp && cp[1] == '.') || *win32_path == '.') | ||||||
|  | 	    attr |= FILE_ATTRIBUTE_HIDDEN; | ||||||
|  | #endif | ||||||
|  | 	  SetFileAttributesA (win32_path.get_win32 (), attr); | ||||||
|  |  | ||||||
| 	  if (win32_path.fs_fast_ea ()) | 	  if (win32_path.fs_fast_ea ()) | ||||||
| 	    set_symlink_ea (win32_path, topath); | 	    set_symlink_ea (win32_path, topath); | ||||||
| 	  res = 0; | 	  res = 0; | ||||||
|   | |||||||
| @@ -1240,7 +1240,16 @@ done: | |||||||
|   else |   else | ||||||
|     { |     { | ||||||
|       /* make the new file have the permissions of the old one */ |       /* 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 */ |       /* Shortcut hack, No. 2, part 2 */ | ||||||
|       /* if the new filename was an existing shortcut, remove it now if the |       /* if the new filename was an existing shortcut, remove it now if the | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user