2009-02-20 02:06:49 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: sw=4 ts=4 sts=4 et
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2011-10-11 09:50:08 +04:00
|
|
|
#include "mozilla/Util.h"
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2005-06-07 23:35:20 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2000-01-25 00:28:28 +03:00
|
|
|
#include "nsDirectoryService.h"
|
2000-08-12 00:25:18 +04:00
|
|
|
#include "nsDirectoryServiceDefs.h"
|
2000-01-25 00:28:28 +03:00
|
|
|
#include "nsLocalFile.h"
|
|
|
|
#include "nsDebug.h"
|
2003-04-04 00:02:03 +04:00
|
|
|
#include "nsStaticAtom.h"
|
2005-06-02 17:29:04 +04:00
|
|
|
#include "nsEnumeratorUtils.h"
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2005-06-07 23:35:20 +04:00
|
|
|
#include "nsICategoryManager.h"
|
|
|
|
#include "nsISimpleEnumerator.h"
|
|
|
|
#include "nsIStringEnumerator.h"
|
|
|
|
|
2006-11-16 12:10:09 +03:00
|
|
|
#if defined(XP_WIN)
|
2000-01-25 00:28:28 +03:00
|
|
|
#include <windows.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2006-11-16 12:10:09 +03:00
|
|
|
#elif defined(XP_UNIX)
|
2000-01-25 00:28:28 +03:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include "prenv.h"
|
2010-04-27 16:57:34 +04:00
|
|
|
#ifdef MOZ_WIDGET_COCOA
|
2002-09-25 16:23:39 +04:00
|
|
|
#include <CoreServices/CoreServices.h>
|
2009-03-19 20:41:13 +03:00
|
|
|
#include <Carbon/Carbon.h>
|
2002-09-25 16:23:39 +04:00
|
|
|
#endif
|
2000-11-29 02:27:38 +03:00
|
|
|
#elif defined(XP_OS2)
|
|
|
|
#define MAX_PATH _MAX_PATH
|
2000-01-25 00:28:28 +03:00
|
|
|
#endif
|
|
|
|
|
2003-03-15 04:04:32 +03:00
|
|
|
#include "SpecialSystemDirectory.h"
|
2002-01-23 02:00:44 +03:00
|
|
|
#include "nsAppFileLocationProvider.h"
|
2000-01-25 00:28:28 +03:00
|
|
|
|
2011-10-11 09:50:08 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2002-04-27 09:33:09 +04:00
|
|
|
#define COMPONENT_DIRECTORY NS_LITERAL_CSTRING("components")
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2000-08-17 02:40:27 +04:00
|
|
|
// define home directory
|
2000-08-30 03:44:48 +04:00
|
|
|
// For Windows platform, We are choosing Appdata folder as HOME
|
2000-11-29 02:27:38 +03:00
|
|
|
#if defined (XP_WIN)
|
2000-08-30 03:44:48 +04:00
|
|
|
#define HOME_DIR NS_WIN_APPDATA_DIR
|
2010-04-27 16:57:34 +04:00
|
|
|
#elif defined (MOZ_WIDGET_COCOA)
|
2003-04-07 11:02:32 +04:00
|
|
|
#define HOME_DIR NS_OSX_HOME_DIR
|
2002-09-25 16:23:39 +04:00
|
|
|
#elif defined (XP_UNIX)
|
2000-08-17 02:40:27 +04:00
|
|
|
#define HOME_DIR NS_UNIX_HOME_DIR
|
2000-11-29 02:27:38 +03:00
|
|
|
#elif defined (XP_OS2)
|
|
|
|
#define HOME_DIR NS_OS2_HOME_DIR
|
2000-08-17 02:40:27 +04:00
|
|
|
#endif
|
2000-01-25 00:28:28 +03:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
2000-08-17 02:40:27 +04:00
|
|
|
nsresult
|
2012-06-06 06:08:30 +04:00
|
|
|
nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile)
|
2000-01-25 00:28:28 +03:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
2002-09-25 16:23:39 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aFile);
|
2012-07-30 18:20:58 +04:00
|
|
|
*aFile = nullptr;
|
2002-09-25 16:23:39 +04:00
|
|
|
|
2000-01-25 23:43:47 +03:00
|
|
|
// Set the component registry location:
|
2005-06-07 23:35:20 +04:00
|
|
|
if (!gService)
|
2000-08-17 02:40:27 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2000-04-21 02:49:18 +04:00
|
|
|
|
2000-08-17 02:40:27 +04:00
|
|
|
nsresult rv;
|
|
|
|
|
2000-01-25 23:43:47 +03:00
|
|
|
nsCOMPtr<nsIProperties> dirService;
|
2012-07-30 18:20:58 +04:00
|
|
|
rv = nsDirectoryService::Create(nullptr,
|
2000-01-25 23:43:47 +03:00
|
|
|
NS_GET_IID(nsIProperties),
|
|
|
|
getter_AddRefs(dirService)); // needs to be around for life of product
|
|
|
|
|
|
|
|
if (dirService)
|
|
|
|
{
|
2012-06-06 06:08:30 +04:00
|
|
|
nsCOMPtr <nsIFile> aLocalFile;
|
|
|
|
dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(aLocalFile));
|
2000-01-25 23:43:47 +03:00
|
|
|
if (aLocalFile)
|
|
|
|
{
|
|
|
|
*aFile = aLocalFile;
|
|
|
|
NS_ADDREF(*aFile);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsLocalFile* localFile = new nsLocalFile;
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
if (localFile == nullptr)
|
2000-01-25 23:43:47 +03:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
NS_ADDREF(localFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-29 02:27:38 +03:00
|
|
|
#ifdef XP_WIN
|
2011-11-29 03:59:20 +04:00
|
|
|
PRUnichar buf[MAX_PATH + 1];
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
if (GetModuleFileNameW(0, buf, mozilla::ArrayLength(buf)) &&
|
|
|
|
GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
2006-03-22 07:26:30 +03:00
|
|
|
// chop off the executable name by finding the rightmost backslash
|
|
|
|
PRUnichar* lastSlash = wcsrchr(buf, L'\\');
|
2000-01-25 00:28:28 +03:00
|
|
|
if (lastSlash)
|
2006-03-22 07:26:30 +03:00
|
|
|
*(lastSlash + 1) = L'\0';
|
|
|
|
|
|
|
|
localFile->InitWithPath(nsDependentString(buf));
|
2000-01-25 23:43:47 +03:00
|
|
|
*aFile = localFile;
|
2000-01-25 00:28:28 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-04-27 16:57:34 +04:00
|
|
|
#elif defined(MOZ_WIDGET_COCOA)
|
2002-09-25 16:23:39 +04:00
|
|
|
// Works even if we're not bundled.
|
|
|
|
CFBundleRef appBundle = CFBundleGetMainBundle();
|
2012-07-30 18:20:58 +04:00
|
|
|
if (appBundle != nullptr)
|
2001-10-27 11:38:18 +04:00
|
|
|
{
|
2002-09-25 16:23:39 +04:00
|
|
|
CFURLRef bundleURL = CFBundleCopyExecutableURL(appBundle);
|
2012-07-30 18:20:58 +04:00
|
|
|
if (bundleURL != nullptr)
|
2001-10-27 11:38:18 +04:00
|
|
|
{
|
2002-09-25 16:23:39 +04:00
|
|
|
CFURLRef parentURL = CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, bundleURL);
|
|
|
|
if (parentURL)
|
2001-10-27 11:38:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
// Pass true for the "resolveAgainstBase" arg to CFURLGetFileSystemRepresentation.
|
2003-04-07 18:29:56 +04:00
|
|
|
// This will resolve the relative portion of the CFURL against it base, giving a full
|
|
|
|
// path, which CFURLCopyFileSystemPath doesn't do.
|
|
|
|
char buffer[PATH_MAX];
|
2011-10-17 18:59:28 +04:00
|
|
|
if (CFURLGetFileSystemRepresentation(parentURL, true, (UInt8 *)buffer, sizeof(buffer)))
|
2002-09-25 16:23:39 +04:00
|
|
|
{
|
|
|
|
#ifdef DEBUG_conrad
|
2003-04-07 18:29:56 +04:00
|
|
|
printf("nsDirectoryService - CurrentProcessDir is: %s\n", buffer);
|
2002-09-25 16:23:39 +04:00
|
|
|
#endif
|
2003-04-07 18:29:56 +04:00
|
|
|
rv = localFile->InitWithNativePath(nsDependentCString(buffer));
|
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
*aFile = localFile;
|
2002-09-25 16:23:39 +04:00
|
|
|
}
|
|
|
|
CFRelease(parentURL);
|
2001-10-27 11:38:18 +04:00
|
|
|
}
|
2002-09-25 16:23:39 +04:00
|
|
|
CFRelease(bundleURL);
|
2001-10-27 11:38:18 +04:00
|
|
|
}
|
|
|
|
}
|
2002-09-25 16:23:39 +04:00
|
|
|
|
2005-09-04 23:10:10 +04:00
|
|
|
NS_ASSERTION(*aFile, "nsDirectoryService - Could not determine CurrentProcessDir.\n");
|
2002-09-25 16:23:39 +04:00
|
|
|
if (*aFile)
|
|
|
|
return NS_OK;
|
2000-01-25 00:28:28 +03:00
|
|
|
|
2002-09-25 16:23:39 +04:00
|
|
|
#elif defined(XP_UNIX)
|
2000-01-25 00:28:28 +03:00
|
|
|
|
|
|
|
// In the absence of a good way to get the executable directory let
|
|
|
|
// us try this for unix:
|
2005-09-04 23:10:10 +04:00
|
|
|
// - if MOZILLA_FIVE_HOME is defined, that is it
|
|
|
|
// - else give the current directory
|
2000-01-25 00:28:28 +03:00
|
|
|
char buf[MAXPATHLEN];
|
2000-10-21 12:33:16 +04:00
|
|
|
|
|
|
|
// The MOZ_DEFAULT_MOZILLA_FIVE_HOME variable can be set at configure time with
|
|
|
|
// a --with-default-mozilla-five-home=foo autoconf flag.
|
|
|
|
//
|
|
|
|
// The idea here is to allow for builds that have a default MOZILLA_FIVE_HOME
|
|
|
|
// regardless of the environment. This makes it easier to write apps that
|
|
|
|
// embed mozilla without having to worry about setting up the environment
|
|
|
|
//
|
2006-03-19 05:52:30 +03:00
|
|
|
// We do this by putenv()ing the default value into the environment. Note that
|
2000-10-21 12:33:16 +04:00
|
|
|
// we only do this if it is not already set.
|
|
|
|
#ifdef MOZ_DEFAULT_MOZILLA_FIVE_HOME
|
2006-03-19 05:52:30 +03:00
|
|
|
const char *home = PR_GetEnv("MOZILLA_FIVE_HOME");
|
|
|
|
if (!home || !*home)
|
2000-10-21 12:33:16 +04:00
|
|
|
{
|
|
|
|
putenv("MOZILLA_FIVE_HOME=" MOZ_DEFAULT_MOZILLA_FIVE_HOME);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");
|
2006-03-19 05:52:30 +03:00
|
|
|
if (moz5 && *moz5)
|
2000-01-25 00:28:28 +03:00
|
|
|
{
|
2003-12-26 01:05:01 +03:00
|
|
|
if (realpath(moz5, buf)) {
|
|
|
|
localFile->InitWithNativePath(nsDependentCString(buf));
|
|
|
|
*aFile = localFile;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2000-01-25 00:28:28 +03:00
|
|
|
}
|
2002-11-28 02:02:17 +03:00
|
|
|
#if defined(DEBUG)
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool firstWarning = true;
|
2000-01-25 00:28:28 +03:00
|
|
|
|
2006-03-19 05:52:30 +03:00
|
|
|
if((!moz5 || !*moz5) && firstWarning) {
|
2003-12-26 01:05:01 +03:00
|
|
|
// Warn that MOZILLA_FIVE_HOME not set, once.
|
|
|
|
printf("Warning: MOZILLA_FIVE_HOME not set.\n");
|
2011-10-17 18:59:28 +04:00
|
|
|
firstWarning = false;
|
2003-12-26 01:05:01 +03:00
|
|
|
}
|
2002-11-28 02:02:17 +03:00
|
|
|
#endif /* DEBUG */
|
2000-01-25 00:28:28 +03:00
|
|
|
|
2003-12-26 01:05:01 +03:00
|
|
|
// Fall back to current directory.
|
|
|
|
if (getcwd(buf, sizeof(buf)))
|
|
|
|
{
|
|
|
|
localFile->InitWithNativePath(nsDependentCString(buf));
|
|
|
|
*aFile = localFile;
|
|
|
|
return NS_OK;
|
2000-01-25 00:28:28 +03:00
|
|
|
}
|
|
|
|
|
2000-11-29 02:27:38 +03:00
|
|
|
#elif defined(XP_OS2)
|
|
|
|
PPIB ppib;
|
|
|
|
PTIB ptib;
|
|
|
|
char buffer[CCHMAXPATH];
|
|
|
|
DosGetInfoBlocks( &ptib, &ppib);
|
|
|
|
DosQueryModuleName( ppib->pib_hmte, CCHMAXPATH, buffer);
|
|
|
|
*strrchr( buffer, '\\') = '\0'; // XXX DBCS misery
|
2002-04-27 09:33:09 +04:00
|
|
|
localFile->InitWithNativePath(nsDependentCString(buffer));
|
2000-11-29 02:27:38 +03:00
|
|
|
*aFile = localFile;
|
|
|
|
return NS_OK;
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
#endif
|
2000-01-25 23:43:47 +03:00
|
|
|
|
2004-01-15 09:14:18 +03:00
|
|
|
NS_RELEASE(localFile);
|
2000-01-25 00:28:28 +03:00
|
|
|
|
|
|
|
NS_ERROR("unable to get current process directory");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
} // GetCurrentProcessDirectory()
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
nsDirectoryService* nsDirectoryService::gService = nullptr;
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2003-04-04 00:02:03 +04:00
|
|
|
nsDirectoryService::nsDirectoryService() :
|
2011-10-17 18:59:28 +04:00
|
|
|
mHashtable(256, true)
|
1999-12-22 04:56:45 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
nsresult
|
1999-12-22 04:56:45 +03:00
|
|
|
nsDirectoryService::Create(nsISupports *outer, REFNSIID aIID, void **aResult)
|
|
|
|
{
|
2000-04-25 05:48:02 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aResult);
|
2005-06-07 23:35:20 +04:00
|
|
|
NS_ENSURE_NO_AGGREGATION(outer);
|
|
|
|
|
|
|
|
if (!gService)
|
2000-01-25 00:28:28 +03:00
|
|
|
{
|
2005-06-07 23:35:20 +04:00
|
|
|
return NS_ERROR_NOT_INITIALIZED;
|
2000-01-25 00:28:28 +03:00
|
|
|
}
|
2005-06-07 23:35:20 +04:00
|
|
|
|
|
|
|
return gService->QueryInterface(aIID, aResult);
|
2000-04-25 05:48:02 +04:00
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
#define DIR_ATOM(name_, value_) nsIAtom* nsDirectoryService::name_ = nullptr;
|
2010-03-08 18:44:59 +03:00
|
|
|
#include "nsDirectoryServiceAtomList.h"
|
|
|
|
#undef DIR_ATOM
|
|
|
|
|
|
|
|
#define DIR_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
|
|
|
|
#include "nsDirectoryServiceAtomList.h"
|
|
|
|
#undef DIR_ATOM
|
|
|
|
|
2003-04-04 00:02:03 +04:00
|
|
|
static const nsStaticAtom directory_atoms[] = {
|
2010-03-08 18:44:59 +03:00
|
|
|
#define DIR_ATOM(name_, value_) NS_STATIC_ATOM(name_##_buffer, &nsDirectoryService::name_),
|
|
|
|
#include "nsDirectoryServiceAtomList.h"
|
|
|
|
#undef DIR_ATOM
|
2003-04-04 00:02:03 +04:00
|
|
|
};
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2005-06-07 23:35:20 +04:00
|
|
|
NS_IMETHODIMP
|
2003-04-04 00:02:03 +04:00
|
|
|
nsDirectoryService::Init()
|
|
|
|
{
|
2005-09-04 23:10:10 +04:00
|
|
|
NS_NOTREACHED("nsDirectoryService::Init() for internal use only!");
|
2005-06-07 23:35:20 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsDirectoryService::RealInit()
|
|
|
|
{
|
2005-09-04 23:10:10 +04:00
|
|
|
NS_ASSERTION(!gService,
|
|
|
|
"nsDirectoryService::RealInit Mustn't initialize twice!");
|
2005-06-07 23:35:20 +04:00
|
|
|
|
2003-04-04 00:02:03 +04:00
|
|
|
nsresult rv;
|
2005-06-07 23:35:20 +04:00
|
|
|
|
|
|
|
nsRefPtr<nsDirectoryService> self = new nsDirectoryService();
|
|
|
|
if (!self)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2005-06-08 00:19:07 +04:00
|
|
|
rv = NS_NewISupportsArray(getter_AddRefs(((nsDirectoryService*) self)->mProviders));
|
2005-06-07 23:35:20 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
2003-04-04 00:02:03 +04:00
|
|
|
|
2012-03-09 06:22:57 +04:00
|
|
|
NS_RegisterStaticAtoms(directory_atoms);
|
2003-04-04 00:02:03 +04:00
|
|
|
|
2002-01-23 02:00:44 +03:00
|
|
|
// Let the list hold the only reference to the provider.
|
|
|
|
nsAppFileLocationProvider *defaultProvider = new nsAppFileLocationProvider;
|
|
|
|
if (!defaultProvider)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2011-10-17 18:59:28 +04:00
|
|
|
// AppendElement returns true for success.
|
2012-08-13 17:32:28 +04:00
|
|
|
rv = static_cast<bool>(((nsDirectoryService*) self)
|
|
|
|
->mProviders->AppendElement(defaultProvider))
|
|
|
|
? NS_OK : NS_ERROR_FAILURE;
|
2005-06-07 23:35:20 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
2002-01-23 02:00:44 +03:00
|
|
|
|
2005-06-07 23:35:20 +04:00
|
|
|
self.swap(gService);
|
|
|
|
return NS_OK;
|
1999-12-22 04:56:45 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
1999-12-22 04:56:45 +03:00
|
|
|
nsDirectoryService::ReleaseValues(nsHashKey* key, void* data, void* closure)
|
|
|
|
{
|
|
|
|
nsISupports* value = (nsISupports*)data;
|
|
|
|
NS_IF_RELEASE(value);
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
1999-12-22 04:56:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsDirectoryService::~nsDirectoryService()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-11-02 18:29:57 +03:00
|
|
|
NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectoryService, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2)
|
1999-12-22 04:56:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-01-25 00:28:28 +03:00
|
|
|
nsDirectoryService::Undefine(const char* prop)
|
1999-12-22 04:56:45 +03:00
|
|
|
{
|
2007-05-13 20:48:39 +04:00
|
|
|
NS_ENSURE_ARG(prop);
|
|
|
|
|
2000-08-10 10:19:37 +04:00
|
|
|
nsCStringKey key(prop);
|
2003-04-04 00:02:03 +04:00
|
|
|
if (!mHashtable.Exists(&key))
|
1999-12-22 04:56:45 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2003-04-04 00:02:03 +04:00
|
|
|
mHashtable.Remove (&key);
|
1999-12-22 04:56:45 +03:00
|
|
|
return NS_OK;
|
2002-08-27 00:36:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDirectoryService::GetKeys(PRUint32 *count, char ***keys)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1999-12-22 04:56:45 +03:00
|
|
|
}
|
|
|
|
|
2001-11-02 18:29:57 +03:00
|
|
|
struct FileData
|
2000-02-22 00:51:47 +03:00
|
|
|
{
|
2001-11-02 18:29:57 +03:00
|
|
|
FileData(const char* aProperty,
|
|
|
|
const nsIID& aUUID) :
|
|
|
|
property(aProperty),
|
2012-07-30 18:20:58 +04:00
|
|
|
data(nullptr),
|
2011-10-17 18:59:28 +04:00
|
|
|
persistent(true),
|
2001-11-02 18:29:57 +03:00
|
|
|
uuid(aUUID) {}
|
|
|
|
|
|
|
|
const char* property;
|
|
|
|
nsISupports* data;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool persistent;
|
2001-11-02 18:29:57 +03:00
|
|
|
const nsIID& uuid;
|
|
|
|
};
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool FindProviderFile(nsISupports* aElement, void *aData)
|
2000-02-22 00:51:47 +03:00
|
|
|
{
|
2000-09-08 08:57:33 +04:00
|
|
|
nsresult rv;
|
2000-02-22 00:51:47 +03:00
|
|
|
FileData* fileData = (FileData*)aData;
|
2001-11-02 18:29:57 +03:00
|
|
|
if (fileData->uuid.Equals(NS_GET_IID(nsISimpleEnumerator)))
|
|
|
|
{
|
|
|
|
// Not all providers implement this iface
|
|
|
|
nsCOMPtr<nsIDirectoryServiceProvider2> prov2 = do_QueryInterface(aElement);
|
|
|
|
if (prov2)
|
|
|
|
{
|
2005-06-02 17:29:04 +04:00
|
|
|
nsCOMPtr<nsISimpleEnumerator> newFiles;
|
|
|
|
rv = prov2->GetFiles(fileData->property, getter_AddRefs(newFiles));
|
|
|
|
if (NS_SUCCEEDED(rv) && newFiles) {
|
|
|
|
if (fileData->data) {
|
|
|
|
nsCOMPtr<nsISimpleEnumerator> unionFiles;
|
|
|
|
|
|
|
|
NS_NewUnionEnumerator(getter_AddRefs(unionFiles),
|
|
|
|
(nsISimpleEnumerator*) fileData->data, newFiles);
|
|
|
|
|
|
|
|
if (unionFiles)
|
|
|
|
unionFiles.swap(* (nsISimpleEnumerator**) &fileData->data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NS_ADDREF(fileData->data = newFiles);
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
fileData->persistent = false; // Enumerators can never be persistent
|
2005-06-02 17:29:04 +04:00
|
|
|
return rv == NS_SUCCESS_AGGREGATE_RESULT;
|
2002-01-23 02:00:44 +03:00
|
|
|
}
|
2001-11-02 18:29:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDirectoryServiceProvider> prov = do_QueryInterface(aElement);
|
2005-04-10 09:43:33 +04:00
|
|
|
if (prov)
|
|
|
|
{
|
|
|
|
rv = prov->GetFile(fileData->property, &fileData->persistent, (nsIFile **)&fileData->data);
|
|
|
|
if (NS_SUCCEEDED(rv) && fileData->data)
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2005-04-10 09:43:33 +04:00
|
|
|
}
|
2001-11-02 18:29:57 +03:00
|
|
|
}
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2000-02-22 00:51:47 +03:00
|
|
|
}
|
|
|
|
|
1999-12-22 04:56:45 +03:00
|
|
|
NS_IMETHODIMP
|
2000-01-25 00:28:28 +03:00
|
|
|
nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
|
1999-12-22 04:56:45 +03:00
|
|
|
{
|
2007-05-13 20:48:39 +04:00
|
|
|
NS_ENSURE_ARG(prop);
|
|
|
|
|
2000-08-10 10:19:37 +04:00
|
|
|
nsCStringKey key(prop);
|
2000-06-21 10:32:45 +04:00
|
|
|
|
2003-04-04 00:02:03 +04:00
|
|
|
nsCOMPtr<nsISupports> value = dont_AddRef(mHashtable.Get(&key));
|
2000-06-21 10:32:45 +04:00
|
|
|
|
|
|
|
if (value)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIFile> cloneFile;
|
|
|
|
nsCOMPtr<nsIFile> cachedFile = do_QueryInterface(value);
|
2005-09-04 23:10:10 +04:00
|
|
|
NS_ASSERTION(cachedFile,
|
|
|
|
"nsDirectoryService::Get nsIFile expected");
|
2000-06-21 10:32:45 +04:00
|
|
|
|
|
|
|
cachedFile->Clone(getter_AddRefs(cloneFile));
|
|
|
|
return cloneFile->QueryInterface(uuid, result);
|
|
|
|
}
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
// it is not one of our defaults, lets check any providers
|
2001-11-02 18:29:57 +03:00
|
|
|
FileData fileData(prop, uuid);
|
2001-07-31 23:05:34 +04:00
|
|
|
|
2002-01-23 02:00:44 +03:00
|
|
|
mProviders->EnumerateBackwards(FindProviderFile, &fileData);
|
2001-11-02 18:29:57 +03:00
|
|
|
if (fileData.data)
|
1999-12-22 04:56:45 +03:00
|
|
|
{
|
2000-08-17 02:40:27 +04:00
|
|
|
if (fileData.persistent)
|
2001-07-31 23:05:34 +04:00
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
Set(prop, static_cast<nsIFile*>(fileData.data));
|
2001-07-31 23:05:34 +04:00
|
|
|
}
|
2001-11-02 18:29:57 +03:00
|
|
|
nsresult rv = (fileData.data)->QueryInterface(uuid, result);
|
|
|
|
NS_RELEASE(fileData.data); // addref occurs in FindProviderFile()
|
2001-07-31 23:05:34 +04:00
|
|
|
return rv;
|
|
|
|
}
|
2002-04-27 09:33:09 +04:00
|
|
|
|
2007-07-08 11:08:04 +04:00
|
|
|
FindProviderFile(static_cast<nsIDirectoryServiceProvider*>(this), &fileData);
|
2001-11-02 18:29:57 +03:00
|
|
|
if (fileData.data)
|
2001-07-31 23:05:34 +04:00
|
|
|
{
|
2000-08-17 02:40:27 +04:00
|
|
|
if (fileData.persistent)
|
2001-07-31 23:05:34 +04:00
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
Set(prop, static_cast<nsIFile*>(fileData.data));
|
2001-07-31 23:05:34 +04:00
|
|
|
}
|
2001-11-02 18:29:57 +03:00
|
|
|
nsresult rv = (fileData.data)->QueryInterface(uuid, result);
|
|
|
|
NS_RELEASE(fileData.data); // addref occurs in FindProviderFile()
|
2001-07-31 23:05:34 +04:00
|
|
|
return rv;
|
1999-12-22 04:56:45 +03:00
|
|
|
}
|
|
|
|
|
2000-01-25 23:43:47 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
1999-12-22 04:56:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-01-25 00:28:28 +03:00
|
|
|
nsDirectoryService::Set(const char* prop, nsISupports* value)
|
1999-12-22 04:56:45 +03:00
|
|
|
{
|
2007-05-13 20:48:39 +04:00
|
|
|
NS_ENSURE_ARG(prop);
|
|
|
|
|
2000-08-10 10:19:37 +04:00
|
|
|
nsCStringKey key(prop);
|
2012-07-30 18:20:58 +04:00
|
|
|
if (mHashtable.Exists(&key) || value == nullptr)
|
1999-12-22 04:56:45 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
2002-04-27 09:33:09 +04:00
|
|
|
|
2000-01-25 23:43:47 +03:00
|
|
|
nsCOMPtr<nsIFile> ourFile;
|
|
|
|
value->QueryInterface(NS_GET_IID(nsIFile), getter_AddRefs(ourFile));
|
|
|
|
if (ourFile)
|
|
|
|
{
|
2000-06-07 02:06:56 +04:00
|
|
|
nsCOMPtr<nsIFile> cloneFile;
|
|
|
|
ourFile->Clone (getter_AddRefs (cloneFile));
|
2003-04-04 00:02:03 +04:00
|
|
|
mHashtable.Put(&key, cloneFile);
|
2002-04-27 09:33:09 +04:00
|
|
|
|
2000-06-21 10:32:45 +04:00
|
|
|
return NS_OK;
|
2000-01-25 23:43:47 +03:00
|
|
|
}
|
2002-04-27 09:33:09 +04:00
|
|
|
|
2000-01-25 23:43:47 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
1999-12-22 04:56:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
nsDirectoryService::Has(const char *prop, bool *_retval)
|
1999-12-22 04:56:45 +03:00
|
|
|
{
|
2007-05-13 20:48:39 +04:00
|
|
|
NS_ENSURE_ARG(prop);
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
*_retval = false;
|
2000-01-25 00:28:28 +03:00
|
|
|
nsCOMPtr<nsIFile> value;
|
|
|
|
nsresult rv = Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(value));
|
2005-06-21 18:45:50 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return NS_OK;
|
2000-01-25 00:28:28 +03:00
|
|
|
|
|
|
|
if (value)
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
*_retval = true;
|
2000-01-25 00:28:28 +03:00
|
|
|
}
|
|
|
|
|
1999-12-22 04:56:45 +03:00
|
|
|
return rv;
|
|
|
|
}
|
2000-02-22 00:51:47 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDirectoryService::RegisterProvider(nsIDirectoryServiceProvider *prov)
|
|
|
|
{
|
2000-04-25 05:48:02 +04:00
|
|
|
nsresult rv;
|
|
|
|
if (!prov)
|
|
|
|
return NS_ERROR_FAILURE;
|
2002-01-23 02:00:44 +03:00
|
|
|
if (!mProviders)
|
|
|
|
return NS_ERROR_NOT_INITIALIZED;
|
2000-04-25 05:48:02 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> supports = do_QueryInterface(prov, &rv);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
// AppendElement returns true for success.
|
2012-08-13 17:32:28 +04:00
|
|
|
return static_cast<bool>(mProviders->AppendElement(supports))
|
|
|
|
? NS_OK : NS_ERROR_FAILURE;
|
2000-02-22 00:51:47 +03:00
|
|
|
}
|
|
|
|
|
2005-06-07 23:35:20 +04:00
|
|
|
void
|
|
|
|
nsDirectoryService::RegisterCategoryProviders()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsICategoryManager> catman
|
|
|
|
(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
|
|
|
|
if (!catman)
|
|
|
|
return;
|
|
|
|
|
|
|
|
nsCOMPtr<nsISimpleEnumerator> entries;
|
|
|
|
catman->EnumerateCategory(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
|
|
|
|
getter_AddRefs(entries));
|
|
|
|
|
|
|
|
nsCOMPtr<nsIUTF8StringEnumerator> strings(do_QueryInterface(entries));
|
|
|
|
if (!strings)
|
|
|
|
return;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool more;
|
2005-06-07 23:35:20 +04:00
|
|
|
while (NS_SUCCEEDED(strings->HasMore(&more)) && more) {
|
|
|
|
nsCAutoString entry;
|
|
|
|
strings->GetNext(entry);
|
|
|
|
|
|
|
|
nsXPIDLCString contractID;
|
|
|
|
catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(), getter_Copies(contractID));
|
|
|
|
|
|
|
|
if (contractID) {
|
|
|
|
nsCOMPtr<nsIDirectoryServiceProvider> provider = do_GetService(contractID.get());
|
|
|
|
if (provider)
|
|
|
|
RegisterProvider(provider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-08 08:57:33 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDirectoryService::UnregisterProvider(nsIDirectoryServiceProvider *prov)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
if (!prov)
|
|
|
|
return NS_ERROR_FAILURE;
|
2002-01-23 02:00:44 +03:00
|
|
|
if (!mProviders)
|
|
|
|
return NS_ERROR_NOT_INITIALIZED;
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2000-09-08 08:57:33 +04:00
|
|
|
nsCOMPtr<nsISupports> supports = do_QueryInterface(prov, &rv);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
// RemoveElement returns true for success.
|
2012-08-13 17:32:28 +04:00
|
|
|
return static_cast<bool>(mProviders->RemoveElement(supports))
|
|
|
|
? NS_OK : NS_ERROR_FAILURE;
|
2000-09-08 08:57:33 +04:00
|
|
|
}
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2000-04-25 05:48:02 +04:00
|
|
|
// DO NOT ADD ANY LOCATIONS TO THIS FUNCTION UNTIL YOU TALK TO: dougt@netscape.com.
|
|
|
|
// This is meant to be a place of xpcom or system specific file locations, not
|
|
|
|
// application specific locations. If you need the later, register a callback for
|
|
|
|
// your application.
|
2000-02-22 00:51:47 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
nsDirectoryService::GetFile(const char *prop, bool *persistent, nsIFile **_retval)
|
2000-02-22 00:51:47 +03:00
|
|
|
{
|
2012-06-06 06:08:30 +04:00
|
|
|
nsCOMPtr<nsIFile> localFile;
|
2005-09-04 23:10:10 +04:00
|
|
|
nsresult rv = NS_ERROR_FAILURE;
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
*_retval = nullptr;
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = true;
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2009-07-17 18:41:26 +04:00
|
|
|
nsCOMPtr<nsIAtom> inAtom = do_GetAtom(prop);
|
2000-04-25 05:48:02 +04:00
|
|
|
|
2005-09-04 23:10:10 +04:00
|
|
|
// check to see if it is one of our defaults
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2003-03-15 04:04:32 +03:00
|
|
|
if (inAtom == nsDirectoryService::sCurrentProcess ||
|
|
|
|
inAtom == nsDirectoryService::sOS_CurrentProcessDirectory )
|
2000-04-25 02:54:04 +04:00
|
|
|
{
|
|
|
|
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
|
|
|
|
}
|
2003-03-15 04:04:32 +03:00
|
|
|
|
|
|
|
// Unless otherwise set, the core pieces of the GRE exist
|
|
|
|
// in the current process directory.
|
2002-09-14 02:18:43 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sGRE_Directory)
|
2002-06-12 00:38:01 +04:00
|
|
|
{
|
|
|
|
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
|
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_DriveDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS_DriveDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_TemporaryDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS_TemporaryDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_CurrentProcessDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS_CurrentProcessDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_CurrentWorkingDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS_CurrentWorkingDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
|
|
|
|
2010-04-27 16:57:34 +04:00
|
|
|
#if defined(MOZ_WIDGET_COCOA)
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kSystemFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sTrashDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kTrashFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sStartupDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kStartupFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sShutdownDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kShutdownFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sAppleMenuDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kAppleMenuFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sControlPanelDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kControlPanelFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sExtensionDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kExtensionFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sFontsDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kFontsFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sPreferencesDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kPreferencesFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sDocumentsDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kDocumentsFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sInternetSearchDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kClassicDomain, kInternetSearchSitesFolderType, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2001-06-14 05:24:22 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sUserLibDirectory)
|
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kUserDomain, kDomainLibraryFolderType, getter_AddRefs(localFile));
|
2002-09-25 16:23:39 +04:00
|
|
|
}
|
2005-03-01 04:03:33 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_HomeDirectory)
|
2002-09-25 16:23:39 +04:00
|
|
|
{
|
2003-04-07 11:02:32 +04:00
|
|
|
rv = GetOSXFolderType(kUserDomain, kDomainTopLevelFolderType, getter_AddRefs(localFile));
|
2002-09-25 16:23:39 +04:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory)
|
|
|
|
{
|
2009-02-20 02:06:49 +03:00
|
|
|
// 10.5 and later, we can use kDownloadsFolderType which is defined in
|
|
|
|
// Folders.h as "down". However, in order to support 10.4 still, we
|
|
|
|
// cannot use the named constant. We'll use it's value, and if it
|
|
|
|
// fails, fall back to the desktop.
|
|
|
|
#ifndef kDownloadsFolderType
|
|
|
|
#define kDownloadsFolderType 'down'
|
|
|
|
#endif
|
2002-09-25 16:23:39 +04:00
|
|
|
|
2009-02-20 02:06:49 +03:00
|
|
|
rv = GetOSXFolderType(kUserDomain, kDownloadsFolderType,
|
|
|
|
getter_AddRefs(localFile));
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kDesktopFolderType,
|
|
|
|
getter_AddRefs(localFile));
|
2002-09-25 16:23:39 +04:00
|
|
|
}
|
|
|
|
}
|
2005-03-01 04:03:33 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sUserDesktopDirectory ||
|
|
|
|
inAtom == nsDirectoryService::sOS_DesktopDirectory)
|
2003-04-07 11:02:32 +04:00
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kDesktopFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sLocalDesktopDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kLocalDomain, kDesktopFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sUserApplicationsDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kApplicationsFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sLocalApplicationsDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kLocalDomain, kApplicationsFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sUserDocumentsDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kDocumentsFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sLocalDocumentsDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kLocalDomain, kDocumentsFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sUserInternetPlugInDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kInternetPlugInFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sLocalInternetPlugInDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kLocalDomain, kInternetPlugInFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sUserFrameworksDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kFrameworksFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sLocalFrameworksDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kLocalDomain, kFrameworksFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sUserPreferencesDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kPreferencesFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sLocalPreferencesDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kLocalDomain, kPreferencesFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sPictureDocumentsDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kPictureDocumentsFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sMovieDocumentsDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kMovieDocumentsFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sMusicDocumentsDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kMusicDocumentsFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sInternetSitesDirectory)
|
|
|
|
{
|
|
|
|
rv = GetOSXFolderType(kUserDomain, kInternetSitesFolderType, getter_AddRefs(localFile));
|
|
|
|
}
|
2000-11-29 02:27:38 +03:00
|
|
|
#elif defined (XP_WIN)
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sSystemDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_SystemDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sWindowsDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_WindowsDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2005-10-09 23:00:19 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sWindowsProgramFiles)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Win_ProgramFiles, getter_AddRefs(localFile));
|
|
|
|
}
|
2005-03-01 04:03:33 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_HomeDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_HomeDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sDesktop)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Desktop, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sPrograms)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Programs, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sControls)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Controls, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sPrinters)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Printers, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sPersonal)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Personal, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sFavorites)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Favorites, getter_AddRefs(localFile));
|
2000-02-22 00:51:47 +03:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sStartup)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Startup, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sRecent)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Recent, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sSendto)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Sendto, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sBitbucket)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Bitbucket, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sStartmenu)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Startmenu, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2005-03-01 04:03:33 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sDesktopdirectory ||
|
|
|
|
inAtom == nsDirectoryService::sOS_DesktopDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Desktopdirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sDrives)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Drives, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sNetwork)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Network, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sNethood)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Nethood, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sFonts)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Fonts, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sTemplates)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Templates, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sCommon_Startmenu)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Common_Startmenu, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sCommon_Programs)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Common_Programs, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sCommon_Startup)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Common_Startup, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sCommon_Desktopdirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Common_Desktopdirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2012-01-05 08:19:14 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sCommon_AppData)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Win_Common_AppData, getter_AddRefs(localFile));
|
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sAppdata)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Appdata, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2005-04-27 15:56:40 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sLocalAppdata)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Win_LocalAppdata, getter_AddRefs(localFile));
|
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sPrinthood)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Printhood, getter_AddRefs(localFile));
|
2003-01-10 05:52:26 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sWinCookiesDirectory)
|
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Win_Cookies, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2006-10-25 00:56:13 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Win_Downloads, getter_AddRefs(localFile));
|
|
|
|
}
|
2002-09-25 16:23:39 +04:00
|
|
|
#elif defined (XP_UNIX)
|
2000-04-21 02:49:18 +04:00
|
|
|
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sLocalDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Unix_LocalDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2000-04-25 05:48:02 +04:00
|
|
|
else if (inAtom == nsDirectoryService::sLibDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Unix_LibDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2005-03-01 04:03:33 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_HomeDirectory)
|
2000-04-21 02:49:18 +04:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Unix_HomeDirectory, getter_AddRefs(localFile));
|
2000-04-21 02:49:18 +04:00
|
|
|
}
|
2008-03-13 01:35:56 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sXDGDesktop ||
|
|
|
|
inAtom == nsDirectoryService::sOS_DesktopDirectory)
|
2005-03-01 04:03:33 +03:00
|
|
|
{
|
2008-03-13 01:35:56 +03:00
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_Desktop, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2008-03-13 01:35:56 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sXDGDocuments)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_Documents, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2008-03-13 01:35:56 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sXDGDownload ||
|
|
|
|
inAtom == nsDirectoryService::sDefaultDownloadDirectory)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_Download, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2008-03-13 01:35:56 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sXDGMusic)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_Music, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2008-03-13 01:35:56 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sXDGPictures)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_Pictures, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2008-03-13 01:35:56 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sXDGPublicShare)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_PublicShare, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2008-03-13 01:35:56 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sXDGTemplates)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_Templates, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2008-03-13 01:35:56 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sXDGVideos)
|
|
|
|
{
|
|
|
|
rv = GetSpecialSystemDirectory(Unix_XDG_Videos, getter_AddRefs(localFile));
|
2011-10-17 18:59:28 +04:00
|
|
|
*persistent = false;
|
2005-03-01 04:03:33 +03:00
|
|
|
}
|
2000-11-29 02:27:38 +03:00
|
|
|
#elif defined (XP_OS2)
|
|
|
|
else if (inAtom == nsDirectoryService::sSystemDirectory)
|
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS2_SystemDirectory, getter_AddRefs(localFile));
|
2000-11-29 02:27:38 +03:00
|
|
|
}
|
|
|
|
else if (inAtom == nsDirectoryService::sOS2Directory)
|
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS2_OS2Directory, getter_AddRefs(localFile));
|
2000-11-29 02:27:38 +03:00
|
|
|
}
|
2005-03-01 04:03:33 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_HomeDirectory)
|
2000-11-29 02:27:38 +03:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS2_HomeDirectory, getter_AddRefs(localFile));
|
2000-11-29 02:27:38 +03:00
|
|
|
}
|
2005-03-01 04:03:33 +03:00
|
|
|
else if (inAtom == nsDirectoryService::sOS_DesktopDirectory)
|
2000-11-29 02:27:38 +03:00
|
|
|
{
|
2003-03-15 04:04:32 +03:00
|
|
|
rv = GetSpecialSystemDirectory(OS2_DesktopDirectory, getter_AddRefs(localFile));
|
2000-11-29 02:27:38 +03:00
|
|
|
}
|
2000-04-21 02:49:18 +04:00
|
|
|
#endif
|
2000-02-22 00:51:47 +03:00
|
|
|
|
2009-07-17 18:41:26 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
2000-04-25 05:48:02 +04:00
|
|
|
|
2009-07-17 18:41:26 +04:00
|
|
|
if (!localFile)
|
|
|
|
return NS_ERROR_FAILURE;
|
2000-04-25 05:48:02 +04:00
|
|
|
|
2009-07-17 18:41:26 +04:00
|
|
|
return CallQueryInterface(localFile, _retval);
|
2000-02-22 00:51:47 +03:00
|
|
|
}
|
|
|
|
|
2001-11-02 18:29:57 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDirectoryService::GetFiles(const char *prop, nsISimpleEnumerator **_retval)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(_retval);
|
2012-07-30 18:20:58 +04:00
|
|
|
*_retval = nullptr;
|
2001-11-02 18:29:57 +03:00
|
|
|
|
2002-06-14 16:30:44 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2001-11-02 18:29:57 +03:00
|
|
|
}
|