Get rid of FILE_ATTRIBUTE_SYMLINK (based on a patch by Bill Medland).

This commit is contained in:
Alexandre Julliard 2002-10-25 03:32:10 +00:00
parent 5a11b009f1
commit 64e047fed3
6 changed files with 13 additions and 15 deletions

View File

@ -80,7 +80,7 @@ static int DIR_GetPath( LPCWSTR keyname, LPCWSTR defval, DOS_FULL_NAME *full_nam
PROFILE_GetWineIniString( wineW, keyname, defval, path, MAX_PATHNAME_LEN ); PROFILE_GetWineIniString( wineW, keyname, defval, path, MAX_PATHNAME_LEN );
if (!DOSFS_GetFullName( path, TRUE, full_name ) || if (!DOSFS_GetFullName( path, TRUE, full_name ) ||
(!FILE_Stat( full_name->long_name, &info ) && (mess=strerror(errno)))|| (!FILE_Stat( full_name->long_name, &info, NULL ) && (mess=strerror(errno)))||
(!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory")) || (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory")) ||
(!(GetLongPathNameW(full_name->short_name, longname, longname_len))) ) (!(GetLongPathNameW(full_name->short_name, longname, longname_len))) )
{ {

View File

@ -1696,7 +1696,7 @@ BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len )
*/ */
static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry ) static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
{ {
DWORD attr = info->attr | FA_UNUSED | FA_ARCHIVE | FA_RDONLY | FILE_ATTRIBUTE_SYMLINK; DWORD attr = info->attr | FA_UNUSED | FA_ARCHIVE | FA_RDONLY;
UINT flags = DRIVE_GetFlags( info->drive ); UINT flags = DRIVE_GetFlags( info->drive );
char *p, buffer[MAX_PATHNAME_LEN]; char *p, buffer[MAX_PATHNAME_LEN];
const char *drive_path; const char *drive_path;
@ -1704,6 +1704,7 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
LPCWSTR long_name, short_name; LPCWSTR long_name, short_name;
BY_HANDLE_FILE_INFORMATION fileinfo; BY_HANDLE_FILE_INFORMATION fileinfo;
WCHAR dos_name[13]; WCHAR dos_name[13];
BOOL is_symlink;
if ((info->attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL) if ((info->attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL)
{ {
@ -1765,13 +1766,12 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
/* Check the file attributes */ /* Check the file attributes */
WideCharToMultiByte(DRIVE_GetCodepage(info->drive), 0, long_name, -1, WideCharToMultiByte(DRIVE_GetCodepage(info->drive), 0, long_name, -1,
p, sizeof(buffer) - (int)(p - buffer), NULL, NULL); p, sizeof(buffer) - (int)(p - buffer), NULL, NULL);
if (!FILE_Stat( buffer, &fileinfo )) if (!FILE_Stat( buffer, &fileinfo, &is_symlink ))
{ {
WARN("can't stat %s\n", buffer); WARN("can't stat %s\n", buffer);
continue; continue;
} }
if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_SYMLINK) && if (is_symlink && (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{ {
static const WCHAR wineW[] = {'w','i','n','e',0}; static const WCHAR wineW[] = {'w','i','n','e',0};
static const WCHAR ShowDirSymlinksW[] = {'S','h','o','w','D','i','r','S','y','m','l','i','n','k','s',0}; static const WCHAR ShowDirSymlinksW[] = {'S','h','o','w','D','i','r','S','y','m','l','i','n','k','s',0};

View File

@ -1104,7 +1104,7 @@ int DRIVE_Chdir( int drive, LPCWSTR path )
buffer[MAX_PATHNAME_LEN - 1] = 0; /* ensure 0 termination */ buffer[MAX_PATHNAME_LEN - 1] = 0; /* ensure 0 termination */
if (!DOSFS_GetFullName( buffer, TRUE, &full_name )) return 0; if (!DOSFS_GetFullName( buffer, TRUE, &full_name )) return 0;
if (!FILE_Stat( full_name.long_name, &info )) return 0; if (!FILE_Stat( full_name.long_name, &info, NULL )) return 0;
if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{ {
SetLastError( ERROR_FILE_NOT_FOUND ); SetLastError( ERROR_FILE_NOT_FOUND );

View File

@ -734,7 +734,7 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info )
* *
* Stat a Unix path name. Return TRUE if OK. * Stat a Unix path name. Return TRUE if OK.
*/ */
BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ) BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink_ptr )
{ {
struct stat st; struct stat st;
int is_symlink; int is_symlink;
@ -756,11 +756,10 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
return FALSE; return FALSE;
} }
} }
/* fill in the information we gathered so far */ /* fill in the information we gathered so far */
FILE_FillInfo( &st, info ); 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 */ /* and now see if this is a hidden file, based on the name */
p = strrchr( unixName, '/'); p = strrchr( unixName, '/');
p = p ? p + 1 : unixName; p = p ? p + 1 : unixName;
@ -774,7 +773,7 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
if (!show_dot_files) if (!show_dot_files)
info->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN; info->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
} }
if (is_symlink_ptr) *is_symlink_ptr = is_symlink;
return TRUE; return TRUE;
} }
@ -849,7 +848,7 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name )
} }
if (!DOSFS_GetFullName( name, TRUE, &full_name) ) if (!DOSFS_GetFullName( name, TRUE, &full_name) )
return -1; return -1;
if (!FILE_Stat( full_name.long_name, &info )) return -1; if (!FILE_Stat( full_name.long_name, &info, NULL )) return -1;
return info.dwFileAttributes; return info.dwFileAttributes;
} }
@ -3361,7 +3360,7 @@ BOOL WINAPI GetFileAttributesExW(
LPWIN32_FILE_ATTRIBUTE_DATA lpFad = LPWIN32_FILE_ATTRIBUTE_DATA lpFad =
(LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation; (LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation;
if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name )) return FALSE; if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name )) return FALSE;
if (!FILE_Stat( full_name.long_name, &info )) return FALSE; if (!FILE_Stat( full_name.long_name, &info, NULL )) return FALSE;
lpFad->dwFileAttributes = info.dwFileAttributes; lpFad->dwFileAttributes = info.dwFileAttributes;
lpFad->ftCreationTime = info.ftCreationTime; lpFad->ftCreationTime = info.ftCreationTime;

View File

@ -73,7 +73,7 @@ extern int FILE_strcasecmp( const char *str1, const char *str2 );
extern int FILE_strncasecmp( const char *str1, const char *str2, int len ); extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
extern void FILE_SetDosError(void); extern void FILE_SetDosError(void);
extern int FILE_GetUnixHandle( HANDLE handle, DWORD access ); extern int FILE_GetUnixHandle( HANDLE handle, DWORD access );
extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ); extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink );
extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 ); extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );
extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES sa, DWORD creation, LPSECURITY_ATTRIBUTES sa, DWORD creation,

View File

@ -3309,7 +3309,6 @@ typedef enum tagSID_NAME_USE {
#define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800L #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
#define FILE_ATTRIBUTE_OFFLINE 0x00001000L #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
#define FILE_ATTRIBUTE_SYMLINK 0x80000000L /* Not in Windows API */
/* File notification flags */ /* File notification flags */
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001