From db45e1ea28d827ca4dfefb1cf65fc61df99b562a Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 13 Nov 2002 19:47:22 +0000 Subject: [PATCH] Maintain lower cased file names in the Wine config directory. --- files/profile.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/files/profile.c b/files/profile.c index 1ade17892e8..660079f49d8 100644 --- a/files/profile.c +++ b/files/profile.c @@ -565,7 +565,7 @@ static BOOL PROFILE_FlushFile(void) if (!(unix_name = CurProfile->unix_name) || !(file = fopen(unix_name, "w"))) { int drive = toupperW(CurProfile->dos_name[0]) - 'A'; - WCHAR *name; + WCHAR *name, *name_lwr; /* Try to create it in $HOME/.wine */ /* FIXME: this will need a more general solution */ strcpy( buffer, wine_get_config_dir() ); @@ -573,8 +573,15 @@ static BOOL PROFILE_FlushFile(void) *p++ = '/'; *p = 0; /* make strlen() below happy */ name = strrchrW( CurProfile->dos_name, '\\' ) + 1; - WideCharToMultiByte(DRIVE_GetCodepage(drive), 0, name, -1, + + /* create a lower cased version of the name */ + name_lwr = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1) * sizeof(WCHAR)); + strcpyW(name_lwr, name); + strlwrW(name_lwr); + WideCharToMultiByte(DRIVE_GetCodepage(drive), 0, name_lwr, -1, p, sizeof(buffer) - strlen(buffer), NULL, NULL); + HeapFree(GetProcessHeap(), 0, name_lwr); + file = fopen( buffer, "w" ); unix_name = buffer; } @@ -626,7 +633,7 @@ static BOOL PROFILE_Open( LPCWSTR filename ) DOS_FULL_NAME full_name; char buffer[MAX_PATHNAME_LEN]; WCHAR *newdos_name; - WCHAR *name; + WCHAR *name, *name_lwr; char *p; FILE *file = NULL; int i,j; @@ -717,8 +724,15 @@ static BOOL PROFILE_Open( LPCWSTR filename ) *p++ = '/'; *p = 0; /* make strlen() below happy */ name = strrchrW( newdos_name, '\\' ) + 1; - WideCharToMultiByte(DRIVE_GetCodepage(full_name.drive), 0, name, -1, + + /* create a lower cased version of the name */ + name_lwr = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1) * sizeof(WCHAR)); + strcpyW(name_lwr, name); + strlwrW(name_lwr); + WideCharToMultiByte(DRIVE_GetCodepage(full_name.drive), 0, name_lwr, -1, p, sizeof(buffer) - strlen(buffer), NULL, NULL); + HeapFree(GetProcessHeap(), 0, name_lwr); + if ((file = fopen( buffer, "r" ))) { TRACE("(%s): found it in %s\n", debugstr_w(filename), buffer );