Fix for Win95 machines which don't have APP_DATA dir

This commit is contained in:
ccarlen%netscape.com 2000-09-09 15:31:27 +00:00
parent a7e68bcf73
commit 68500bd674
2 changed files with 28 additions and 0 deletions

View File

@ -497,6 +497,20 @@ static nsresult GetDefaultUserProfileRoot(nsILocalFile **aLocalFile)
}
#elif defined(XP_PC)
rv = GetWindowsFolder(CSIDL_APPDATA, aLocalFile);
if (NS_SUCCEEDED(rv)) {
rv = (*aLocalFile)->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists) {
char path[_MAX_PATH];
PRInt32 len = GetWindowsDirectory( path, _MAX_PATH );
// Need enough space to add the trailing backslash
if (len <= _MAX_PATH-2) {
path[len] = '\\';
path[len+1] = '\0';
}
rv = NS_NewLocalFile(path, PR_TRUE, aLocalFile);
}
}
NS_ENSURE_SUCCESS(rv, rv);
pLocalFile = *aLocalFile;
pLocalFile->AppendRelativePath("Mozilla");

View File

@ -497,6 +497,20 @@ static nsresult GetDefaultUserProfileRoot(nsILocalFile **aLocalFile)
}
#elif defined(XP_PC)
rv = GetWindowsFolder(CSIDL_APPDATA, aLocalFile);
if (NS_SUCCEEDED(rv)) {
rv = (*aLocalFile)->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists) {
char path[_MAX_PATH];
PRInt32 len = GetWindowsDirectory( path, _MAX_PATH );
// Need enough space to add the trailing backslash
if (len <= _MAX_PATH-2) {
path[len] = '\\';
path[len+1] = '\0';
}
rv = NS_NewLocalFile(path, PR_TRUE, aLocalFile);
}
}
NS_ENSURE_SUCCESS(rv, rv);
pLocalFile = *aLocalFile;
pLocalFile->AppendRelativePath("Mozilla");