105087 r=dveditz, sr=mscott, a=asa
hook up the installer and the directory service
This commit is contained in:
Родитель
4bb72906a4
Коммит
090982c461
|
@ -106,4 +106,5 @@
|
||||||
#define NS_APP_NEWS_50_DIR "NewsD"
|
#define NS_APP_NEWS_50_DIR "NewsD"
|
||||||
#define NS_APP_MESSENGER_FOLDER_CACHE_50_DIR "MFCaD"
|
#define NS_APP_MESSENGER_FOLDER_CACHE_50_DIR "MFCaD"
|
||||||
|
|
||||||
|
#define NS_APP_INSTALL_CLEANUP_DIR "XPIClnupD" //location of xpicleanup.dat xpicleanup.exe
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
|
|
||||||
#if defined(XP_MAC) /* || defined(XP_MACOSX) REMIND HACKING FOR MACOS X!!! */
|
#if defined(XP_MAC) /* || defined(XP_MACOSX) REMIND HACKING FOR MACOS X!!! */
|
||||||
#define APP_REGISTRY_NAME "Application Registry"
|
#define APP_REGISTRY_NAME "Application Registry"
|
||||||
|
#define ESSENTIAL_FILES "Essential Files"
|
||||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||||
#define APP_REGISTRY_NAME "registry.dat"
|
#define APP_REGISTRY_NAME "registry.dat"
|
||||||
#else
|
#else
|
||||||
|
@ -204,7 +205,17 @@ nsAppFileLocationProvider::GetFile(const char *prop, PRBool *persistant, nsIFile
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = localFile->AppendRelativePath(SEARCH_DIR_NAME);
|
rv = localFile->AppendRelativePath(SEARCH_DIR_NAME);
|
||||||
}
|
}
|
||||||
|
else if (nsCRT::strcmp(prop, NS_APP_INSTALL_CLEANUP_DIR) == 0)
|
||||||
|
{
|
||||||
|
// This is cloned so that embeddors will have a hook to override
|
||||||
|
// with their own cleanup dir. See bugzilla bug #105087
|
||||||
|
rv = CloneMozBinDirectory(getter_AddRefs(localFile));
|
||||||
|
#ifdef XP_MAC
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
rv = localFile->Append(ESSENTIAL_FILES);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (localFile && NS_SUCCEEDED(rv))
|
if (localFile && NS_SUCCEEDED(rv))
|
||||||
return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval);
|
return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval);
|
||||||
|
|
|
@ -1137,15 +1137,12 @@ static nsresult VerifyInstallation(int argc, char **argv)
|
||||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR,
|
rv = directoryService->Get(NS_APP_INSTALL_CLEANUP_DIR,
|
||||||
NS_GET_IID(nsIFile),
|
NS_GET_IID(nsIFile),
|
||||||
getter_AddRefs(registryFile));
|
getter_AddRefs(registryFile));
|
||||||
if (NS_FAILED(rv) || !registryFile)
|
if (NS_FAILED(rv) || !registryFile)
|
||||||
return NS_OK;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
#ifdef XP_MAC
|
|
||||||
registryFile->Append(ESSENTIAL_FILES);
|
|
||||||
#endif
|
|
||||||
registryFile->Append(CLEANUP_REGISTRY);
|
registryFile->Append(CLEANUP_REGISTRY);
|
||||||
|
|
||||||
PRBool exists;
|
PRBool exists;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "nsSpecialSystemDirectory.h"
|
#include "nsSpecialSystemDirectory.h"
|
||||||
#include "nsDirectoryService.h"
|
#include "nsDirectoryService.h"
|
||||||
#include "nsDirectoryServiceDefs.h"
|
#include "nsDirectoryServiceDefs.h"
|
||||||
|
#include "nsAppDirectoryServiceDefs.h"
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
GetPersistentStringFromSpec(nsIFile* inSpec, char **string)
|
GetPersistentStringFromSpec(nsIFile* inSpec, char **string)
|
||||||
|
@ -135,15 +136,28 @@ char* GetRegFilePath()
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
directoryService->Get(NS_OS_CURRENT_PROCESS_DIR,
|
if (nsSoftwareUpdate::GetProgramDirectory()) // In the stub installer
|
||||||
NS_GET_IID(nsIFile),
|
{
|
||||||
getter_AddRefs(iFileUtilityPath));
|
nsCOMPtr<nsIFile> tmp;
|
||||||
if (!iFileUtilityPath)
|
rv = nsSoftwareUpdate::GetProgramDirectory()->Clone(getter_AddRefs(tmp));
|
||||||
return nsnull;
|
|
||||||
|
if (NS_FAILED(rv) || !tmp)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
#if defined (XP_MAC)
|
#if defined (XP_MAC)
|
||||||
iFileUtilityPath->Append(ESSENTIAL_FILES);
|
tmp->Append(ESSENTIAL_FILES);
|
||||||
#endif
|
#endif
|
||||||
|
iFileUtilityPath = do_QueryInterface(tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rv = directoryService->Get(NS_APP_INSTALL_CLEANUP_DIR,
|
||||||
|
NS_GET_IID(nsIFile),
|
||||||
|
getter_AddRefs(iFileUtilityPath));
|
||||||
|
}
|
||||||
|
if (NS_FAILED(rv) || !iFileUtilityPath)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
iFileUtilityPath->Append(CLEANUP_REGISTRY);
|
iFileUtilityPath->Append(CLEANUP_REGISTRY);
|
||||||
|
|
||||||
//Yes, we know using GetPath is buggy on the Mac.
|
//Yes, we know using GetPath is buggy on the Mac.
|
||||||
|
|
|
@ -175,12 +175,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
|
||||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||||
if (!directoryService) return;
|
if (!directoryService) return;
|
||||||
|
|
||||||
directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec));
|
directoryService->Get(NS_APP_PLUGINS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec));
|
||||||
#ifdef XP_MAC
|
|
||||||
mFileSpec->Append("Plug-ins");
|
|
||||||
#else
|
|
||||||
mFileSpec->Append("plugins");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -188,11 +183,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
#ifdef XP_MAC
|
mFileSpec->Append(INSTALL_PLUGINS_DIR);
|
||||||
mFileSpec->Append("Plug-ins");
|
|
||||||
#else
|
|
||||||
mFileSpec->Append("plugins");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mFileSpec = nsnull;
|
mFileSpec = nsnull;
|
||||||
|
@ -285,18 +276,9 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
|
||||||
nsCOMPtr<nsIProperties> directoryService =
|
nsCOMPtr<nsIProperties> directoryService =
|
||||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||||
if (!directoryService) return;
|
if (!directoryService) return;
|
||||||
directoryService->Get(NS_OS_CURRENT_PROCESS_DIR,
|
directoryService->Get(NS_XPCOM_COMPONENT_DIR,
|
||||||
NS_GET_IID(nsIFile),
|
NS_GET_IID(nsIFile),
|
||||||
getter_AddRefs(mFileSpec));
|
getter_AddRefs(mFileSpec));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
#ifdef XP_MAC
|
|
||||||
mFileSpec->Append("Components");
|
|
||||||
#else
|
|
||||||
mFileSpec->Append("components");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -304,11 +286,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
#ifdef XP_MAC
|
mFileSpec->Append(INSTALL_COMPONENTS_DIR);
|
||||||
mFileSpec->Append("Components");
|
|
||||||
#else
|
|
||||||
mFileSpec->Append("components");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mFileSpec = nsnull;
|
mFileSpec = nsnull;
|
||||||
|
@ -321,19 +299,9 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
|
||||||
nsCOMPtr<nsIProperties> directoryService =
|
nsCOMPtr<nsIProperties> directoryService =
|
||||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||||
if (!directoryService) return;
|
if (!directoryService) return;
|
||||||
directoryService->Get(NS_OS_CURRENT_PROCESS_DIR,
|
directoryService->Get(NS_APP_CHROME_DIR,
|
||||||
NS_GET_IID(nsIFile),
|
NS_GET_IID(nsIFile),
|
||||||
getter_AddRefs(mFileSpec));
|
getter_AddRefs(mFileSpec));
|
||||||
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
#ifdef XP_MAC
|
|
||||||
mFileSpec->Append("Chrome");
|
|
||||||
#else
|
|
||||||
mFileSpec->Append("chrome");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -341,11 +309,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
#ifdef XP_MAC
|
mFileSpec->Append(INSTALL_CHROME_DIR);
|
||||||
mFileSpec->Append("Chrome");
|
|
||||||
#else
|
|
||||||
mFileSpec->Append("chrome");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,6 +34,16 @@
|
||||||
#include "nsFileSpec.h"
|
#include "nsFileSpec.h"
|
||||||
#include "nsSpecialSystemDirectory.h"
|
#include "nsSpecialSystemDirectory.h"
|
||||||
|
|
||||||
|
#ifdef XP_MAC
|
||||||
|
#define INSTALL_PLUGINS_DIR "Plug-ins"
|
||||||
|
#define INSTALL_COMPONENTS_DIR "Components"
|
||||||
|
#define INSTALL_CHROME_DIR "Chrome"
|
||||||
|
#else
|
||||||
|
#define INSTALL_PLUGINS_DIR "plugins"
|
||||||
|
#define INSTALL_COMPONENTS_DIR "components"
|
||||||
|
#define INSTALL_CHROME_DIR "chrome"
|
||||||
|
#endif
|
||||||
|
|
||||||
class nsInstallFolder
|
class nsInstallFolder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "nsIChromeRegistry.h"
|
#include "nsIChromeRegistry.h"
|
||||||
#include "nsIDirectoryService.h"
|
#include "nsIDirectoryService.h"
|
||||||
#include "nsDirectoryServiceDefs.h"
|
#include "nsDirectoryServiceDefs.h"
|
||||||
|
#include "nsAppDirectoryServiceDefs.h"
|
||||||
|
|
||||||
MOZ_DECL_CTOR_COUNTER(nsRegisterItem)
|
MOZ_DECL_CTOR_COUNTER(nsRegisterItem)
|
||||||
|
|
||||||
|
@ -259,36 +260,52 @@ PRInt32 nsRegisterItem::Complete()
|
||||||
{
|
{
|
||||||
// Either script asked for delayed chrome or we can't find
|
// Either script asked for delayed chrome or we can't find
|
||||||
// the chrome registry to do it now.
|
// the chrome registry to do it now.
|
||||||
NS_ASSERTION(mProgDir, "this.Prepare() failed to set mProgDir");
|
|
||||||
|
|
||||||
// construct a reference to the magic file
|
// construct a reference to the magic file
|
||||||
PRFileDesc* fd = nsnull;
|
PRFileDesc* fd = nsnull;
|
||||||
nsCOMPtr<nsIFile> tmp;
|
nsCOMPtr<nsIFile> tmp;
|
||||||
PRBool bExists = PR_FALSE;
|
PRBool bExists = PR_FALSE;
|
||||||
rv = mProgDir->Clone(getter_AddRefs(tmp));
|
if (!nsSoftwareUpdate::GetProgramDirectory()) // not in the stub installer
|
||||||
if (NS_SUCCEEDED(rv))
|
{
|
||||||
|
nsCOMPtr<nsIProperties> directoryService =
|
||||||
|
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||||
|
if (NS_SUCCEEDED(rv) && directoryService)
|
||||||
|
{
|
||||||
|
rv = directoryService->Get(NS_APP_CHROME_DIR,
|
||||||
|
NS_GET_IID(nsIFile),
|
||||||
|
getter_AddRefs(tmp));
|
||||||
|
if(NS_FAILED(rv))
|
||||||
|
{
|
||||||
|
result = nsInstall::CHROME_REGISTRY_ERROR;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsILocalFile> startupFile( do_QueryInterface(tmp, &rv) );
|
rv = nsSoftwareUpdate::GetProgramDirectory()->Clone(getter_AddRefs(tmp));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
rv = startupFile->Append("chrome");
|
tmp->Append(INSTALL_CHROME_DIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nsCOMPtr<nsILocalFile> startupFile( do_QueryInterface(tmp, &rv) );
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
{
|
||||||
|
rv = startupFile->Exists(&bExists);
|
||||||
|
if (NS_SUCCEEDED(rv) && !bExists)
|
||||||
|
rv = startupFile->Create(nsIFile::DIRECTORY_TYPE, 0755);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
{
|
||||||
|
rv = startupFile->Append("installed-chrome.txt");
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
rv = startupFile->Exists(&bExists);
|
rv = startupFile->OpenNSPRFileDesc(
|
||||||
if (NS_SUCCEEDED(rv) && !bExists)
|
PR_CREATE_FILE | PR_WRONLY,
|
||||||
rv = startupFile->Create(nsIFile::DIRECTORY_TYPE, 0755);
|
0744,
|
||||||
if (NS_SUCCEEDED(rv))
|
&fd);
|
||||||
{
|
|
||||||
rv = startupFile->Append("installed-chrome.txt");
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
rv = startupFile->OpenNSPRFileDesc(
|
|
||||||
PR_CREATE_FILE | PR_WRONLY,
|
|
||||||
0744,
|
|
||||||
&fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "VerReg.h"
|
#include "VerReg.h"
|
||||||
#include "nsIDirectoryService.h"
|
#include "nsIDirectoryService.h"
|
||||||
#include "nsDirectoryServiceDefs.h"
|
#include "nsDirectoryServiceDefs.h"
|
||||||
|
#include "nsAppDirectoryServiceDefs.h"
|
||||||
|
|
||||||
#include "nsInstall.h"
|
#include "nsInstall.h"
|
||||||
#include "nsSoftwareUpdateIIDs.h"
|
#include "nsSoftwareUpdateIIDs.h"
|
||||||
|
@ -199,12 +200,26 @@ nsSoftwareUpdate::Shutdown()
|
||||||
//Get the program directory
|
//Get the program directory
|
||||||
nsCOMPtr<nsIProperties> directoryService =
|
nsCOMPtr<nsIProperties> directoryService =
|
||||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||||
directoryService->Get(NS_OS_CURRENT_PROCESS_DIR,
|
|
||||||
NS_GET_IID(nsIFile),
|
if (nsSoftwareUpdate::GetProgramDirectory()) // In the stub installer
|
||||||
getter_AddRefs(pathToCleanupUtility));
|
{
|
||||||
|
nsCOMPtr<nsIFile> tmp;
|
||||||
|
rv = nsSoftwareUpdate::GetProgramDirectory()->Clone(getter_AddRefs(tmp));
|
||||||
#if defined (XP_MAC)
|
#if defined (XP_MAC)
|
||||||
pathToCleanupUtility->Append(ESSENTIAL_FILES);
|
tmp->Append(ESSENTIAL_FILES);
|
||||||
#endif
|
#endif
|
||||||
|
pathToCleanupUtility = do_QueryInterface(tmp);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rv = directoryService->Get(NS_APP_INSTALL_CLEANUP_DIR,
|
||||||
|
NS_GET_IID(nsIFile),
|
||||||
|
getter_AddRefs(pathToCleanupUtility));
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ASSERTION(pathToCleanupUtility,"No path to cleanup utility in nsSoftwareUpdate::Shutdown()");
|
||||||
|
|
||||||
//Create the Process framework
|
//Create the Process framework
|
||||||
pathToCleanupUtility->Append(CLEANUP_UTIL);
|
pathToCleanupUtility->Append(CLEANUP_UTIL);
|
||||||
nsCOMPtr<nsIProcess> cleanupProcess = do_CreateInstance(kIProcessCID);
|
nsCOMPtr<nsIProcess> cleanupProcess = do_CreateInstance(kIProcessCID);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче