Hide dot files
Dimitrie O. Paun
dpaun at rogers.com
Mon Sep 16 00:52:22 CDT 2002
Alexandre, modified as follows:
-- ., and .. are not marked as FA_HIDDEN
-- you can turn off this behaviour by setting ShowDotFiles=1
in the configuration file.
-- documentation patched accordingly
ChangeLog
Mark files starting with a dot as FA_HIDDEN.
Add configuration option 'ShowDotFiles' to turn this feature off.
Index: documentation/wine.conf.man
===================================================================
RCS file: /var/cvs/wine/documentation/wine.conf.man,v
retrieving revision 1.4
diff -u -r1.4 wine.conf.man
--- documentation/wine.conf.man 25 Jun 2002 00:23:23 -0000 1.4
+++ documentation/wine.conf.man 14 Sep 2002 21:41:17 -0000
@@ -153,6 +153,15 @@
x11drv (for X11). In case you want to run programs as text console/TTY only
without having Wine rely on X11 support, then use ttydrv.
.PP
+.I format: """ShowDotFiles""=""<0|1>"""
+.br
+default: "0"
+.br
+Under Unix, files starting with a dot, are considered hidden,
+and should not be shown in directory listing (unless explicitly asked for),
+just like DOS-style hidden files. If you want them treated as regular
+files, set this value to 1.
+.PP
.B [Version]
.br
.I format: """Windows""=""<version string>"""
Index: documentation/wine.texinfo
===================================================================
RCS file: /var/cvs/wine/documentation/wine.texinfo,v
retrieving revision 1.6
diff -u -r1.6 wine.texinfo
--- documentation/wine.texinfo 19 Mar 2002 02:10:35 -0000 1.6
+++ documentation/wine.texinfo 14 Sep 2002 21:41:45 -0000
@@ -800,8 +800,10 @@
The file is a read-only file. (Wine value: 0x0001).
@end defvr
@defvr_cw32 FILE_ATTRIBUTE_HIDDEN
-The file is a hidden file. Files in Wine do not have this attribute. (Wine value:
-0x0002).
+The file is a hidden file. Wine can set this attribute for files starting
+with a dot (normally considered hidden in a Unix environment). This behaviour
+is controlled by the @code{ShowDotFiles} configuration setting.
+(Wine value: 0x0002).
@end defvr
@defvr_cw32 FILE_ATTRIBUTE_SYSTEM
The file belongs to the operating system. Files in Wine do not have this
Index: documentation/samples/config
===================================================================
RCS file: /var/cvs/wine/documentation/samples/config,v
retrieving revision 1.28
diff -u -r1.28 config
--- documentation/samples/config 10 Jul 2002 23:08:32 -0000 1.28
+++ documentation/samples/config 14 Sep 2002 21:42:06 -0000
@@ -67,6 +67,7 @@
; Enabling this may crash some programs that do recursive lookups of a whole
; subdir tree in case of a symlink pointing back to itself.
;"ShowDirSymlinks" = "1"
+;"ShowDotFiles" = "1"
"ShellLinker" = "wineshelllink"
# <wineconf>
Index: files/file.c
===================================================================
RCS file: /var/cvs/wine/files/file.c,v
retrieving revision 1.162
diff -u -r1.162 file.c
--- files/file.c 13 Sep 2002 17:55:33 -0000 1.162
+++ files/file.c 16 Sep 2002 05:45:26 -0000
@@ -735,14 +735,16 @@
BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
{
struct stat st;
+ int is_symlink;
+ LPCSTR p;
if (lstat( unixName, &st ) == -1)
{
FILE_SetDosError();
return FALSE;
}
- if (!S_ISLNK(st.st_mode)) FILE_FillInfo( &st, info );
- else
+ is_symlink = S_ISLNK(st.st_mode);
+ if (is_symlink)
{
/* do a "real" stat to find out
about the type of the symlink destination */
@@ -751,9 +753,26 @@
FILE_SetDosError();
return FALSE;
}
- FILE_FillInfo( &st, info );
- info->dwFileAttributes |= FILE_ATTRIBUTE_SYMLINK;
}
+
+ /* fill in the information we gathered so far */
+ FILE_FillInfo( &st, info );
+ if (is_symlink) info->dwFileAttributes |= FILE_ATTRIBUTE_SYMLINK;
+
+ /* and now see if this is a hidden file, based on the name */
+ p = strrchr( unixName, '/');
+ p = p ? p + 1 : unixName;
+ if (*p == '.' && *(p+1) && (*(p+1) != '.' || *(p+2)))
+ {
+ static const WCHAR wineW[] = {'w','i','n','e',0};
+ static const WCHAR ShowDotFilesW[] = {'S','h','o','w','D','o','t','F','i','l','e','s',0};
+ static int show_dot_files = -1;
+ if (show_dot_files == -1)
+ show_dot_files = PROFILE_GetWineIniBool(wineW, ShowDotFilesW, 0);
+ if (!show_dot_files)
+ info->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
+ }
+
return TRUE;
}
More information about the wine-patches
mailing list