Mac v2 signing - Bug 1046924 - Move updates directory out of the .app bundle. r=rstrong

This commit is contained in:
Stephen Pohl 2014-09-29 11:51:08 -07:00
Родитель 7959bd3a2b
Коммит ec201051e3
3 изменённых файлов: 39 добавлений и 5 удалений

Просмотреть файл

@ -83,7 +83,7 @@ LaunchMacPostProcess(const char* aAppBundle)
NSString* iniPath = [NSString stringWithUTF8String:aAppBundle];
iniPath =
[iniPath stringByAppendingPathComponent:@"Contents/MacOS/updater.ini"];
[iniPath stringByAppendingPathComponent:@"Contents/Resources/updater.ini"];
NSFileManager* fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:iniPath]) {

Просмотреть файл

@ -341,7 +341,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
{
// Copy the updater application from the GRE and the updater ini from the app
#if defined(XP_MACOSX)
if (!CopyFileIntoUpdateDir(greDir, kUpdaterApp, updateDir))
if (!CopyFileIntoUpdateDir(appDir, kUpdaterApp, updateDir))
return false;
#else
if (!CopyFileIntoUpdateDir(greDir, kUpdaterBin, updateDir))

Просмотреть файл

@ -231,7 +231,7 @@ nsXREDirProvider::GetUserProfilesLocalDir(nsIFile** aResult,
NS_IMETHODIMP
nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
nsIFile** aFile)
nsIFile** aFile)
{
nsresult rv;
@ -1031,8 +1031,42 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
rv = appFile->GetParent(getter_AddRefs(updRoot));
NS_ENSURE_SUCCESS(rv, rv);
#ifdef XP_WIN
#ifdef XP_MACOSX
nsCOMPtr<nsIFile> appRootDirFile;
nsCOMPtr<nsIFile> localDir;
nsAutoString appDirPath;
if (NS_FAILED(appFile->GetParent(getter_AddRefs(appRootDirFile))) ||
NS_FAILED(appRootDirFile->GetPath(appDirPath)) ||
NS_FAILED(GetUserDataDirectoryHome(getter_AddRefs(localDir), true))) {
return NS_ERROR_FAILURE;
}
int32_t dotIndex = appDirPath.RFind(".app");
if (dotIndex == kNotFound) {
dotIndex = appDirPath.Length();
}
appDirPath = Substring(appDirPath, 1, dotIndex - 1);
bool hasVendor = gAppData->vendor && strlen(gAppData->vendor) != 0;
if (hasVendor || gAppData->name) {
if (NS_FAILED(localDir->AppendNative(nsDependentCString(hasVendor ?
gAppData->vendor :
gAppData->name)))) {
return NS_ERROR_FAILURE;
}
} else if (NS_FAILED(localDir->AppendNative(NS_LITERAL_CSTRING("Mozilla")))) {
return NS_ERROR_FAILURE;
}
if (NS_FAILED(localDir->Append(NS_LITERAL_STRING("updates"))) ||
NS_FAILED(localDir->AppendRelativePath(appDirPath))) {
return NS_ERROR_FAILURE;
}
NS_ADDREF(*aResult = localDir);
return NS_OK;
#elif XP_WIN
nsAutoString pathHash;
bool pathHashResult = false;
bool hasVendor = gAppData->vendor && strlen(gAppData->vendor) != 0;
@ -1121,7 +1155,7 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
rv = updRoot->AppendRelativePath(programName);
NS_ENSURE_SUCCESS(rv, rv);
#endif
#endif // XP_WIN
#endif
NS_ADDREF(*aResult = updRoot);
return NS_OK;