follow up landing of 193442. This fixes the strcmp logic error we has when checking for the gre string r=dbradley, alecf, darin

This commit is contained in:
dougt%netscape.com 2003-03-06 17:41:01 +00:00
Родитель e76b550493
Коммит 888e2a5aa3
1 изменённых файлов: 34 добавлений и 4 удалений

Просмотреть файл

@ -131,6 +131,7 @@ PRBool xptiManifest::Write(xptiInterfaceInfoManager* aMgr,
PRUint32 size32;
PRIntn interfaceCount = 0;
nsCAutoString appDirString;
nsCOMPtr<nsIFile> greDirectory;
nsCOMPtr<nsILocalFile> tempFile;
if(!aMgr->GetCloneOfManifestDir(getter_AddRefs(tempFile)) || !tempFile)
@ -177,6 +178,8 @@ PRBool xptiManifest::Write(xptiInterfaceInfoManager* aMgr,
(int) aWorkingSet->GetDirectoryCount()))
goto out;
NS_GetSpecialDirectory(NS_GRE_COMPONENT_DIR, getter_AddRefs(greDirectory));
for(i = 0; i < aWorkingSet->GetDirectoryCount(); i++)
{
nsCOMPtr<nsILocalFile> dir;
@ -186,9 +189,19 @@ PRBool xptiManifest::Write(xptiInterfaceInfoManager* aMgr,
if(!dir)
goto out;
dir->GetPersistentDescriptor(str);
if(str.IsEmpty())
goto out;
PRBool isGREDir = PR_FALSE;
if (greDirectory)
dir->Equals(greDirectory, &isGREDir);
if (isGREDir) {
str = "gre";
}
else
{
dir->GetPersistentDescriptor(str);
if(str.IsEmpty())
goto out;
}
if(!PR_fprintf(fd, "%d,%s\n", (int) i, str.get()))
goto out;
@ -491,6 +504,8 @@ PRBool xptiManifest::Read(xptiInterfaceInfoManager* aMgr,
for(i = 0; i < dirCount; ++i)
{
nsCAutoString str;
if(!reader.NextLine())
goto out;
@ -502,8 +517,23 @@ PRBool xptiManifest::Read(xptiInterfaceInfoManager* aMgr,
if(i != atoi(values[0]))
goto out;
if (0 != PL_strcmp(values[1], "gre"))
{
nsCOMPtr<nsIFile> greDirectory;
NS_GetSpecialDirectory(NS_GRE_COMPONENT_DIR, getter_AddRefs(greDirectory));
nsCOMPtr<nsILocalFile> lFile = do_QueryInterface(greDirectory);
if (!lFile)
goto out;
lFile->GetPersistentDescriptor(str);
}
else
{
str = values[1];
}
// directoryname
if(!aWorkingSet->DirectoryAtMatchesPersistentDescriptor(i, values[1]))
if(!aWorkingSet->DirectoryAtMatchesPersistentDescriptor(i, str.get()))
goto out;
}