From 14fb095758fd2dacf4a914c243f3eae7aeaaf934 Mon Sep 17 00:00:00 2001 From: "Dimitrie O. Paun" Date: Mon, 16 Sep 2002 22:44:38 +0000 Subject: [PATCH] Mark files starting with a dot as FA_HIDDEN. Add configuration option 'ShowDotFiles' to turn this feature off. --- documentation/samples/config | 1 + documentation/wine.conf.man | 9 +++++++++ documentation/wine.texinfo | 6 ++++-- files/file.c | 27 +++++++++++++++++++++++---- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/documentation/samples/config b/documentation/samples/config index 05616fe8d54..ba5b6a6e949 100644 --- a/documentation/samples/config +++ b/documentation/samples/config @@ -67,6 +67,7 @@ WINE REGISTRY Version 2 ; 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" # diff --git a/documentation/wine.conf.man b/documentation/wine.conf.man index 57921f58e68..f14128bfed5 100644 --- a/documentation/wine.conf.man +++ b/documentation/wine.conf.man @@ -153,6 +153,15 @@ Tells Wine which graphics driver to use. Normally you'd want to use 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""=""""" diff --git a/documentation/wine.texinfo b/documentation/wine.texinfo index 48bcada974d..d1c248b5d90 100644 --- a/documentation/wine.texinfo +++ b/documentation/wine.texinfo @@ -800,8 +800,10 @@ are a logical @emph{or} of one or more of the following constants: 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 diff --git a/files/file.c b/files/file.c index f3452644a7e..a10ac10723a 100644 --- a/files/file.c +++ b/files/file.c @@ -735,14 +735,16 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info ) 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 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ) 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; }