Landing file rewrite changes for conrad

This commit is contained in:
pinkerton%netscape.com 2002-06-26 21:59:47 +00:00
parent cf41775d56
commit e7a1e228dd
16 changed files with 256 additions and 32 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001, 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Conrad Carlen <ccarlen@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef __AppDirServiceProvider_h__ #define __AppDirServiceProvider_h__ #include "nsIDirectoryService.h" #include "nsILocalFile.h" #include "nsString.h" class nsIFile; //***************************************************************************** // class AppDirServiceProvider //***************************************************************************** class AppDirServiceProvider : public nsIDirectoryServiceProvider { public: AppDirServiceProvider(const nsACString& productDirName); NS_DECL_ISUPPORTS NS_DECL_NSIDIRECTORYSERVICEPROVIDER protected: virtual ~AppDirServiceProvider(); NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile); NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile); nsCString mProductDirName; }; #endif // __AppDirServiceProvider_h__

View File

@ -45,6 +45,7 @@
#include "nsIPrefService.h"
#include "nsString.h"
#include "nsEmbedAPI.h"
#include "AppDirServiceProvider.h"
#ifdef _BUILD_STATIC_BIN
@ -101,17 +102,30 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
- (BOOL) initMozillaPrefs
{
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1);
nsresult rv;
#ifdef _BUILD_STATIC_BIN
// Initialize XPCOM's module info table
NSGetStaticModuleInfo = app_getModuleInfo;
#endif
rv = NS_InitEmbedding(nsnull, nsnull);
nsresult rv;
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
const char *binDirPath = [path fileSystemRepresentation];
nsCOMPtr<nsILocalFile> binDir;
rv = NS_NewNativeLocalFile(nsDependentCString(binDirPath), PR_TRUE, getter_AddRefs(binDir));
if (NS_FAILED(rv))
return NO;
// This shouldn't be needed since we are initing XPCOM with this
// directory but causes a (harmless) warning if not defined.
setenv("MOZILLA_FIVE_HOME", binDirPath, 1);
// Supply our own directory service provider so we can control where
// the registry and profiles are located.
AppDirServiceProvider *provider = new AppDirServiceProvider(NS_LITERAL_CSTRING("Project X"));
NS_ASSERTION(provider, "Failed to create AppDirServiceProvider");
rv = NS_InitEmbedding(binDir, provider);
if (NS_FAILED(rv)) {
printf("Embedding init failed.\n");
return NO;
@ -121,7 +135,7 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
if (NS_FAILED(rv))
return NO;
nsAutoString newProfileName(NS_LITERAL_STRING("Chimera"));
nsAutoString newProfileName(NS_LITERAL_STRING("default"));
PRBool profileExists = PR_FALSE;
rv = profileService->ProfileExists(newProfileName.get(), &profileExists);
if (NS_FAILED(rv))

View File

@ -197,6 +197,8 @@
29B97315FDCFA39411CA2CEA = {
children = (
29B97316FDCFA39411CA2CEA,
F59236C002C89AC90100012B,
F59236C102C89AC90100012B,
F56F241F02AC6D0401A967F3,
F5D1421902BC88F801A967F3,
);
@ -277,7 +279,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../intl/unicharutil/util ../modules/zlib/src";
OPTIMIZATION_CFLAGS = "-O2";
@ -449,6 +451,7 @@
F53E012A02AEE91D01A967F3,
F53E013302AEEA2901A967F3,
F632AF8502B9AEBB01000103,
F59236C202C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -560,6 +563,7 @@
2E748B75029A448D4B000102,
F53E012D02AEE93701A967F3,
F632AF8602B9AEBC01000103,
F59236C302C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;
@ -4095,6 +4099,40 @@
name = Nibs;
refType = 4;
};
F59236C002C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.cpp;
refType = 4;
};
F59236C102C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.h;
refType = 4;
};
F59236C202C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C302C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C402C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C502C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F5948A48029EB9C801000102 = {
children = (
F5948A49029EB9E301000102,
@ -4217,7 +4255,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../dist/lib/components ../intl/unicharutil/src ../security/nss/lib/crmf/Darwin5.5_OPT.OBJ ../gfx/src ../js/src/liveconnect ../intl/unicharutil/util";
OPTIMIZATION_CFLAGS = "-O2";
@ -4387,6 +4425,7 @@
F5BAAB4102AC4A2E01A967F3,
F53E012B02AEE91D01A967F3,
F53E013402AEEA2901A967F3,
F59236C402C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -4498,6 +4537,7 @@
F5BAAB9A02AC4A5301A967F3,
F56F242102AC6D0401A967F3,
F53E012E02AEE93701A967F3,
F59236C502C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;

View File

@ -197,6 +197,8 @@
29B97315FDCFA39411CA2CEA = {
children = (
29B97316FDCFA39411CA2CEA,
F59236C002C89AC90100012B,
F59236C102C89AC90100012B,
F56F241F02AC6D0401A967F3,
F5D1421902BC88F801A967F3,
);
@ -277,7 +279,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../intl/unicharutil/util ../modules/zlib/src";
OPTIMIZATION_CFLAGS = "-O2";
@ -449,6 +451,7 @@
F53E012A02AEE91D01A967F3,
F53E013302AEEA2901A967F3,
F632AF8502B9AEBB01000103,
F59236C202C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -560,6 +563,7 @@
2E748B75029A448D4B000102,
F53E012D02AEE93701A967F3,
F632AF8602B9AEBC01000103,
F59236C302C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;
@ -4095,6 +4099,40 @@
name = Nibs;
refType = 4;
};
F59236C002C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.cpp;
refType = 4;
};
F59236C102C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.h;
refType = 4;
};
F59236C202C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C302C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C402C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C502C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F5948A48029EB9C801000102 = {
children = (
F5948A49029EB9E301000102,
@ -4217,7 +4255,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../dist/lib/components ../intl/unicharutil/src ../security/nss/lib/crmf/Darwin5.5_OPT.OBJ ../gfx/src ../js/src/liveconnect ../intl/unicharutil/util";
OPTIMIZATION_CFLAGS = "-O2";
@ -4387,6 +4425,7 @@
F5BAAB4102AC4A2E01A967F3,
F53E012B02AEE91D01A967F3,
F53E013402AEEA2901A967F3,
F59236C402C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -4498,6 +4537,7 @@
F5BAAB9A02AC4A5301A967F3,
F56F242102AC6D0401A967F3,
F53E012E02AEE93701A967F3,
F59236C502C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001, 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Conrad Carlen <ccarlen@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef __AppDirServiceProvider_h__ #define __AppDirServiceProvider_h__ #include "nsIDirectoryService.h" #include "nsILocalFile.h" #include "nsString.h" class nsIFile; //***************************************************************************** // class AppDirServiceProvider //***************************************************************************** class AppDirServiceProvider : public nsIDirectoryServiceProvider { public: AppDirServiceProvider(const nsACString& productDirName); NS_DECL_ISUPPORTS NS_DECL_NSIDIRECTORYSERVICEPROVIDER protected: virtual ~AppDirServiceProvider(); NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile); NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile); nsCString mProductDirName; }; #endif // __AppDirServiceProvider_h__

View File

@ -45,6 +45,7 @@
#include "nsIPrefService.h"
#include "nsString.h"
#include "nsEmbedAPI.h"
#include "AppDirServiceProvider.h"
#ifdef _BUILD_STATIC_BIN
@ -101,17 +102,30 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
- (BOOL) initMozillaPrefs
{
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1);
nsresult rv;
#ifdef _BUILD_STATIC_BIN
// Initialize XPCOM's module info table
NSGetStaticModuleInfo = app_getModuleInfo;
#endif
rv = NS_InitEmbedding(nsnull, nsnull);
nsresult rv;
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
const char *binDirPath = [path fileSystemRepresentation];
nsCOMPtr<nsILocalFile> binDir;
rv = NS_NewNativeLocalFile(nsDependentCString(binDirPath), PR_TRUE, getter_AddRefs(binDir));
if (NS_FAILED(rv))
return NO;
// This shouldn't be needed since we are initing XPCOM with this
// directory but causes a (harmless) warning if not defined.
setenv("MOZILLA_FIVE_HOME", binDirPath, 1);
// Supply our own directory service provider so we can control where
// the registry and profiles are located.
AppDirServiceProvider *provider = new AppDirServiceProvider(NS_LITERAL_CSTRING("Project X"));
NS_ASSERTION(provider, "Failed to create AppDirServiceProvider");
rv = NS_InitEmbedding(binDir, provider);
if (NS_FAILED(rv)) {
printf("Embedding init failed.\n");
return NO;
@ -121,7 +135,7 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
if (NS_FAILED(rv))
return NO;
nsAutoString newProfileName(NS_LITERAL_STRING("Chimera"));
nsAutoString newProfileName(NS_LITERAL_STRING("default"));
PRBool profileExists = PR_FALSE;
rv = profileService->ProfileExists(newProfileName.get(), &profileExists);
if (NS_FAILED(rv))

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001, 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Conrad Carlen <ccarlen@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef __AppDirServiceProvider_h__ #define __AppDirServiceProvider_h__ #include "nsIDirectoryService.h" #include "nsILocalFile.h" #include "nsString.h" class nsIFile; //***************************************************************************** // class AppDirServiceProvider //***************************************************************************** class AppDirServiceProvider : public nsIDirectoryServiceProvider { public: AppDirServiceProvider(const nsACString& productDirName); NS_DECL_ISUPPORTS NS_DECL_NSIDIRECTORYSERVICEPROVIDER protected: virtual ~AppDirServiceProvider(); NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile); NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile); nsCString mProductDirName; }; #endif // __AppDirServiceProvider_h__

View File

@ -45,6 +45,7 @@
#include "nsIPrefService.h"
#include "nsString.h"
#include "nsEmbedAPI.h"
#include "AppDirServiceProvider.h"
#ifdef _BUILD_STATIC_BIN
@ -101,17 +102,30 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
- (BOOL) initMozillaPrefs
{
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1);
nsresult rv;
#ifdef _BUILD_STATIC_BIN
// Initialize XPCOM's module info table
NSGetStaticModuleInfo = app_getModuleInfo;
#endif
rv = NS_InitEmbedding(nsnull, nsnull);
nsresult rv;
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
const char *binDirPath = [path fileSystemRepresentation];
nsCOMPtr<nsILocalFile> binDir;
rv = NS_NewNativeLocalFile(nsDependentCString(binDirPath), PR_TRUE, getter_AddRefs(binDir));
if (NS_FAILED(rv))
return NO;
// This shouldn't be needed since we are initing XPCOM with this
// directory but causes a (harmless) warning if not defined.
setenv("MOZILLA_FIVE_HOME", binDirPath, 1);
// Supply our own directory service provider so we can control where
// the registry and profiles are located.
AppDirServiceProvider *provider = new AppDirServiceProvider(NS_LITERAL_CSTRING("Project X"));
NS_ASSERTION(provider, "Failed to create AppDirServiceProvider");
rv = NS_InitEmbedding(binDir, provider);
if (NS_FAILED(rv)) {
printf("Embedding init failed.\n");
return NO;
@ -121,7 +135,7 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
if (NS_FAILED(rv))
return NO;
nsAutoString newProfileName(NS_LITERAL_STRING("Chimera"));
nsAutoString newProfileName(NS_LITERAL_STRING("default"));
PRBool profileExists = PR_FALSE;
rv = profileService->ProfileExists(newProfileName.get(), &profileExists);
if (NS_FAILED(rv))

View File

@ -197,6 +197,8 @@
29B97315FDCFA39411CA2CEA = {
children = (
29B97316FDCFA39411CA2CEA,
F59236C002C89AC90100012B,
F59236C102C89AC90100012B,
F56F241F02AC6D0401A967F3,
F5D1421902BC88F801A967F3,
);
@ -277,7 +279,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../intl/unicharutil/util ../modules/zlib/src";
OPTIMIZATION_CFLAGS = "-O2";
@ -449,6 +451,7 @@
F53E012A02AEE91D01A967F3,
F53E013302AEEA2901A967F3,
F632AF8502B9AEBB01000103,
F59236C202C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -560,6 +563,7 @@
2E748B75029A448D4B000102,
F53E012D02AEE93701A967F3,
F632AF8602B9AEBC01000103,
F59236C302C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;
@ -4095,6 +4099,40 @@
name = Nibs;
refType = 4;
};
F59236C002C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.cpp;
refType = 4;
};
F59236C102C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.h;
refType = 4;
};
F59236C202C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C302C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C402C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C502C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F5948A48029EB9C801000102 = {
children = (
F5948A49029EB9E301000102,
@ -4217,7 +4255,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../dist/lib/components ../intl/unicharutil/src ../security/nss/lib/crmf/Darwin5.5_OPT.OBJ ../gfx/src ../js/src/liveconnect ../intl/unicharutil/util";
OPTIMIZATION_CFLAGS = "-O2";
@ -4387,6 +4425,7 @@
F5BAAB4102AC4A2E01A967F3,
F53E012B02AEE91D01A967F3,
F53E013402AEEA2901A967F3,
F59236C402C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -4498,6 +4537,7 @@
F5BAAB9A02AC4A5301A967F3,
F56F242102AC6D0401A967F3,
F53E012E02AEE93701A967F3,
F59236C502C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;

View File

@ -197,6 +197,8 @@
29B97315FDCFA39411CA2CEA = {
children = (
29B97316FDCFA39411CA2CEA,
F59236C002C89AC90100012B,
F59236C102C89AC90100012B,
F56F241F02AC6D0401A967F3,
F5D1421902BC88F801A967F3,
);
@ -277,7 +279,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../intl/unicharutil/util ../modules/zlib/src";
OPTIMIZATION_CFLAGS = "-O2";
@ -449,6 +451,7 @@
F53E012A02AEE91D01A967F3,
F53E013302AEEA2901A967F3,
F632AF8502B9AEBB01000103,
F59236C202C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -560,6 +563,7 @@
2E748B75029A448D4B000102,
F53E012D02AEE93701A967F3,
F632AF8602B9AEBC01000103,
F59236C302C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;
@ -4095,6 +4099,40 @@
name = Nibs;
refType = 4;
};
F59236C002C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.cpp;
refType = 4;
};
F59236C102C89AC90100012B = {
isa = PBXFileReference;
path = AppDirServiceProvider.h;
refType = 4;
};
F59236C202C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C302C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C402C89ACA0100012B = {
fileRef = F59236C102C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F59236C502C89ACA0100012B = {
fileRef = F59236C002C89AC90100012B;
isa = PBXBuildFile;
settings = {
};
};
F5948A48029EB9C801000102 = {
children = (
F5948A49029EB9E301000102,
@ -4217,7 +4255,7 @@
buildSettings = {
DEBUGGING_SYMBOLS = NO;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom";
HEADER_SEARCH_PATHS = "../dist/include/intl ../dist/include/pipboot ../dist/include/pipnss ../dist/include/webbrwsr ../dist/include/dom ../dist/include/nspr ../dist/include/string ../dist/include/rdf ../dist/include/necko ../dist/include/find ../dist/include/embed_base ../dist/include/windowwatcher ../dist/include/webshell ../dist/include/widget ../dist/include/uriloader ../dist/include/docshell ../dist/include/profile ../dist/include/layout ../dist/include/content ../dist/include/webbrowserpersist ../dist/include/pref ../dist/include/mimetype ../dist/include/shistory ../dist/include/view ../dist/include/gfx ../dist/include/xultmpl ../dist/include/xmlextras ../dist/include/htmlparser ../dist/include/locale ../dist/include/unicharutil ../dist/include/appcomps ../dist/include/chrome ../dist/include/xpcom \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"";
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "../dist/bin ../dist/lib ../dist/lib/components ../intl/unicharutil/src ../security/nss/lib/crmf/Darwin5.5_OPT.OBJ ../gfx/src ../js/src/liveconnect ../intl/unicharutil/util";
OPTIMIZATION_CFLAGS = "-O2";
@ -4387,6 +4425,7 @@
F5BAAB4102AC4A2E01A967F3,
F53E012B02AEE91D01A967F3,
F53E013402AEEA2901A967F3,
F59236C402C89ACA0100012B,
);
isa = PBXHeadersBuildPhase;
name = Headers;
@ -4498,6 +4537,7 @@
F5BAAB9A02AC4A5301A967F3,
F56F242102AC6D0401A967F3,
F53E012E02AEE93701A967F3,
F59236C502C89ACA0100012B,
);
isa = PBXSourcesBuildPhase;
name = Sources;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001, 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Conrad Carlen <ccarlen@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef __AppDirServiceProvider_h__ #define __AppDirServiceProvider_h__ #include "nsIDirectoryService.h" #include "nsILocalFile.h" #include "nsString.h" class nsIFile; //***************************************************************************** // class AppDirServiceProvider //***************************************************************************** class AppDirServiceProvider : public nsIDirectoryServiceProvider { public: AppDirServiceProvider(const nsACString& productDirName); NS_DECL_ISUPPORTS NS_DECL_NSIDIRECTORYSERVICEPROVIDER protected: virtual ~AppDirServiceProvider(); NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile); NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile); nsCString mProductDirName; }; #endif // __AppDirServiceProvider_h__

View File

@ -45,6 +45,7 @@
#include "nsIPrefService.h"
#include "nsString.h"
#include "nsEmbedAPI.h"
#include "AppDirServiceProvider.h"
#ifdef _BUILD_STATIC_BIN
@ -101,17 +102,30 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
- (BOOL) initMozillaPrefs
{
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1);
nsresult rv;
#ifdef _BUILD_STATIC_BIN
// Initialize XPCOM's module info table
NSGetStaticModuleInfo = app_getModuleInfo;
#endif
rv = NS_InitEmbedding(nsnull, nsnull);
nsresult rv;
NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent];
const char *binDirPath = [path fileSystemRepresentation];
nsCOMPtr<nsILocalFile> binDir;
rv = NS_NewNativeLocalFile(nsDependentCString(binDirPath), PR_TRUE, getter_AddRefs(binDir));
if (NS_FAILED(rv))
return NO;
// This shouldn't be needed since we are initing XPCOM with this
// directory but causes a (harmless) warning if not defined.
setenv("MOZILLA_FIVE_HOME", binDirPath, 1);
// Supply our own directory service provider so we can control where
// the registry and profiles are located.
AppDirServiceProvider *provider = new AppDirServiceProvider(NS_LITERAL_CSTRING("Project X"));
NS_ASSERTION(provider, "Failed to create AppDirServiceProvider");
rv = NS_InitEmbedding(binDir, provider);
if (NS_FAILED(rv)) {
printf("Embedding init failed.\n");
return NO;
@ -121,7 +135,7 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count);
if (NS_FAILED(rv))
return NO;
nsAutoString newProfileName(NS_LITERAL_STRING("Chimera"));
nsAutoString newProfileName(NS_LITERAL_STRING("default"));
PRBool profileExists = PR_FALSE;
rv = profileService->ProfileExists(newProfileName.get(), &profileExists);
if (NS_FAILED(rv))