Use long names, not 8.3 names in environment.

This commit is contained in:
Juergen Schmied 2002-05-09 19:35:22 +00:00 committed by Alexandre Julliard
parent ce830a9c18
commit 6b27977ab5
1 changed files with 10 additions and 8 deletions

View File

@ -59,7 +59,7 @@ static DOS_FULL_NAME DIR_System;
* Get a path name from the wine.ini file and make sure it is valid. * Get a path name from the wine.ini file and make sure it is valid.
*/ */
static int DIR_GetPath( const char *keyname, const char *defval, static int DIR_GetPath( const char *keyname, const char *defval,
DOS_FULL_NAME *full_name, BOOL warn ) DOS_FULL_NAME *full_name, char * longname, BOOL warn )
{ {
char path[MAX_PATHNAME_LEN]; char path[MAX_PATHNAME_LEN];
BY_HANDLE_FILE_INFORMATION info; BY_HANDLE_FILE_INFORMATION info;
@ -68,7 +68,8 @@ static int DIR_GetPath( const char *keyname, const char *defval,
PROFILE_GetWineIniString( "wine", keyname, defval, path, sizeof(path) ); PROFILE_GetWineIniString( "wine", keyname, defval, path, sizeof(path) );
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 ) && (mess=strerror(errno)))||
(!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory"))) (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory")) ||
(!(GetLongPathNameA(full_name->short_name, longname, MAX_PATHNAME_LEN))) )
{ {
if (warn) if (warn)
MESSAGE("Invalid path '%s' for %s directory: %s\n", path, keyname, mess); MESSAGE("Invalid path '%s' for %s directory: %s\n", path, keyname, mess);
@ -84,6 +85,7 @@ static int DIR_GetPath( const char *keyname, const char *defval,
int DIR_Init(void) int DIR_Init(void)
{ {
char path[MAX_PATHNAME_LEN]; char path[MAX_PATHNAME_LEN];
char longpath[MAX_PATHNAME_LEN];
DOS_FULL_NAME tmp_dir, profile_dir; DOS_FULL_NAME tmp_dir, profile_dir;
int drive; int drive;
const char *cwd; const char *cwd;
@ -106,9 +108,9 @@ int DIR_Init(void)
DRIVE_Chdir( drive, cwd ); DRIVE_Chdir( drive, cwd );
} }
if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows, TRUE )) || if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows, longpath, TRUE )) ||
!(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System, TRUE )) || !(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System, longpath, TRUE )) ||
!(DIR_GetPath( "temp", "c:\\windows", &tmp_dir, TRUE ))) !(DIR_GetPath( "temp", "c:\\windows", &tmp_dir, longpath, TRUE )))
{ {
PROFILE_UsageWineIni(); PROFILE_UsageWineIni();
return 0; return 0;
@ -163,10 +165,10 @@ int DIR_Init(void)
TRACE("Cwd = %c:\\%s\n", TRACE("Cwd = %c:\\%s\n",
'A' + drive, DRIVE_GetDosCwd( drive ) ); 'A' + drive, DRIVE_GetDosCwd( drive ) );
if (DIR_GetPath( "profile", "", &profile_dir, FALSE )) if (DIR_GetPath( "profile", "", &profile_dir, longpath, FALSE ))
{ {
TRACE("USERPROFILE= %s\n", profile_dir.short_name ); TRACE("USERPROFILE= %s\n", longpath );
SetEnvironmentVariableA( "USERPROFILE", profile_dir.short_name ); SetEnvironmentVariableA( "USERPROFILE", longpath );
} }
TRACE("SYSTEMROOT = %s\n", DIR_Windows.short_name ); TRACE("SYSTEMROOT = %s\n", DIR_Windows.short_name );