Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsXREDirProvider.cpp File Reference
#include "nsAppRunner.h"
#include "nsXREDirProvider.h"
#include "jsapi.h"
#include "nsIJSContextStack.h"
#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsIProfileChangeStatus.h"
#include "nsIToolkitChromeRegistry.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsXULAppAPI.h"
#include "nsINIParser.h"
#include "nsDependentString.h"
#include "nsCOMArray.h"
#include "nsArrayEnumerator.h"
#include <stdlib.h>

Go to the source code of this file.

Classes

class  ProfileChangeStatusImpl

Defines

#define APP_REGISTRY_NAME   "appreg"
#define PREF_OVERRIDE_DIRNAME   "preferences"

Functions

 NS_IMPL_QUERY_INTERFACE3 (nsXREDirProvider, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2, nsIProfileStartup) nsXREDirProvider
static void LoadDirsIntoArray (nsIFile *aComponentsList, const char *aSection, const char *const *aAppendList, nsCOMArray< nsIFile > &aDirectories)
static void GetProfileFolderName (char *aProfileFolderName, const char *aSource)

Variables

nsXREDirProvidergDirServiceProvider = nsnull
static const char *const kAppendChromeManifests []

Define Documentation

#define APP_REGISTRY_NAME   "appreg"

Definition at line 95 of file nsXREDirProvider.cpp.

#define PREF_OVERRIDE_DIRNAME   "preferences"

Definition at line 98 of file nsXREDirProvider.cpp.


Function Documentation

static void GetProfileFolderName ( char *  aProfileFolderName,
const char *  aSource 
) [static]

Definition at line 695 of file nsXREDirProvider.cpp.

{
  const char* reading = aSource;

  while (*reading) {
    *aProfileFolderName = tolower(*reading);
    ++aProfileFolderName; ++reading;
  }
  *aProfileFolderName = '\0';
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void LoadDirsIntoArray ( nsIFile aComponentsList,
const char *  aSection,
const char *const aAppendList,
nsCOMArray< nsIFile > &  aDirectories 
) [static]

Definition at line 355 of file nsXREDirProvider.cpp.

{
  nsINIParser parser;
  nsCOMPtr<nsILocalFile> lf(do_QueryInterface(aComponentsList));
  nsresult rv =  parser.Init(lf);
  if (NS_FAILED(rv))
    return;

  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

  PRInt32 i = 0;
  do {
    nsCAutoString buf("Extension");
    buf.AppendInt(i++);

    nsCAutoString path;
    rv = parser.GetString(aSection, buf.get(), path);
    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(path);
    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);
}

Here is the call graph for this function:

Definition at line 155 of file nsXREDirProvider.cpp.

{
  return 1;
}

Variable Documentation

Definition at line 100 of file nsXREDirProvider.cpp.

Initial value:
  { "chrome.manifest", nsnull }

Definition at line 438 of file nsXREDirProvider.cpp.