nsresult rv; char parserBuf[MAXPATHLEN]; char buf[18];
LoadDirsIntoArray(nsIFile* aComponentsList, const char* aSection,                  const char *const* aAppendList,                  nsCOMArray<nsIFile>& aDirectories){  nsINIParser parser;  nsCOMPtr<nsILocalFile> lf(do_QueryInterface(aComponentsList));  parser.Init(lf);  NS_NAMED_LITERAL_CSTRING(platform, "platform");  NS_NAMED_LITERAL_CSTRING(osTarget, OS_TARGET);#ifdef TARGET_OS_ABI  NS_NAMED_LITERAL_CSTRING(targetOSABI, TARGET_OS_ABI);#endif  nsresult rv;  char parserBuf[MAXPATHLEN];  char buf[18];  PRInt32 i = 0;  do {    sprintf(buf, "Extension%d", i++);    rv = parser.GetString(aSection, buf, parserBuf, MAXPATHLEN);    if (NS_FAILED(rv))      break;    nsCOMPtr<nsILocalFile> dir = do_CreateInstance("@mozilla.org/file/local;1", &rv);    if (NS_FAILED(rv))      continue;    nsCOMPtr<nsIFile> platformDir;#ifdef TARGET_OS_ABI    nsCOMPtr<nsIFile> platformABIDir;#endif    rv = dir->SetPersistentDescriptor(nsDependentCString(parserBuf));    if (NS_FAILED(rv))      continue;    rv = dir->Clone(getter_AddRefs(platformDir));    if (NS_FAILED(rv))      continue;    platformDir->AppendNative(platform);    platformDir->AppendNative(osTarget);#ifdef TARGET_OS_ABI    rv = dir->Clone(getter_AddRefs(platformABIDir));    if (NS_FAILED(rv))      continue;    platformABIDir->AppendNative(platform);    platformABIDir->AppendNative(targetOSABI);#endif    const char* const* a = aAppendList;    while (*a) {      nsDependentCString directory(*a);      dir->AppendNative(directory);      platformDir->AppendNative(directory);#ifdef TARGET_OS_ABI      platformABIDir->AppendNative(directory);#endif      ++a;    }    PRBool exists;    rv = dir->Exists(&exists);    if (NS_SUCCEEDED(rv) && exists)      aDirectories.AppendObject(dir);    rv = platformDir->Exists(&exists);    if (NS_SUCCEEDED(rv) && exists)      aDirectories.AppendObject(platformDir);#ifdef TARGET_OS_ABI    rv = platformABIDir->Exists(&exists);    if (NS_SUCCEEDED(rv) && exists)      aDirectories.AppendObject(platformABIDir);#endif  }  while (PR_TRUE);}