зеркало из https://github.com/mozilla/pjs.git
Bug 436719: Read updater.ini from app dir, not gre. r=bsmedberg, r=robstrong
This commit is contained in:
Родитель
0653ac9735
Коммит
1bc0aea457
|
@ -601,6 +601,7 @@ components/websrvcs.xpt
|
|||
components/widget_mac.xpt
|
||||
components/xml-rpc.xpt
|
||||
components/xpcom_obsolete.xpt
|
||||
updater.app/Contents/MacOS/updater.ini
|
||||
init.d/README
|
||||
redo-prebinding.sh
|
||||
res/viewer.properties
|
||||
|
|
|
@ -308,14 +308,10 @@ libs:: $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini)
|
|||
ifeq ($(OS_ARCH),WINNT)
|
||||
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
||||
iconv -f UTF-8 -t $(WIN_INSTALLER_CHARSET) > $(FINAL_TARGET)/updater.ini
|
||||
else
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/updater.app/Contents/MacOS
|
||||
else
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_CRASHREPORTER
|
||||
libs:: $(addprefix $(LOCALE_SRCDIR)/,crashreporter/crashreporter-override.ini)
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
static float sProgressVal; // between 0 and 100
|
||||
static BOOL sQuit = FALSE;
|
||||
static StringTable sLabels;
|
||||
static const char *sProgramPath;
|
||||
static const char *sUpdatePath;
|
||||
|
||||
@interface UpdaterUI : NSObject
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ static const char *sProgramPath;
|
|||
int
|
||||
InitProgressUI(int *pargc, char ***pargv)
|
||||
{
|
||||
sProgramPath = (*pargv)[0];
|
||||
sUpdatePath = (*pargv)[1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ ShowProgressUI()
|
|||
return 0;
|
||||
|
||||
char path[PATH_MAX];
|
||||
snprintf(path, sizeof(path), "%s.ini", sProgramPath);
|
||||
snprintf(path, sizeof(path), "%s/updater.ini", sUpdatePath);
|
||||
if (ReadStrings(path, &sLabels) != OK)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -275,28 +275,13 @@ SetStatus(nsILocalFile *statusFile, const char *status)
|
|||
}
|
||||
|
||||
static PRBool
|
||||
CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
||||
nsCOMPtr<nsIFile> &updater)
|
||||
CopyFileIntoUpdateDir(nsIFile *parentDir, const char *leafName, nsIFile *updateDir)
|
||||
{
|
||||
// We have to move the updater binary and its resource file.
|
||||
const char *filesToMove[] = {
|
||||
#if defined(XP_MACOSX)
|
||||
kUpdaterApp,
|
||||
#else
|
||||
kUpdaterINI,
|
||||
kUpdaterBin,
|
||||
#endif
|
||||
nsnull
|
||||
};
|
||||
|
||||
nsresult rv;
|
||||
|
||||
for (const char **leafName = filesToMove; *leafName; ++leafName) {
|
||||
nsDependentCString leaf(*leafName);
|
||||
nsDependentCString leaf(leafName);
|
||||
nsCOMPtr<nsIFile> file;
|
||||
|
||||
// Make sure there is not an existing file in the target location.
|
||||
rv = updateDir->Clone(getter_AddRefs(file));
|
||||
nsresult rv = updateDir->Clone(getter_AddRefs(file));
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
rv = file->AppendNative(leaf);
|
||||
|
@ -305,19 +290,35 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
|||
file->Remove(PR_FALSE);
|
||||
|
||||
// Now, copy into the target location.
|
||||
rv = greDir->Clone(getter_AddRefs(file));
|
||||
rv = parentDir->Clone(getter_AddRefs(file));
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
rv = file->AppendNative(leaf);
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
rv = file->CopyToNative(updateDir, EmptyCString());
|
||||
if (*leafName != kUpdaterINI && NS_FAILED(rv))
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
||||
nsCOMPtr<nsIFile> &updater)
|
||||
{
|
||||
// Copy the updater application from the GRE and the updater ini from the app
|
||||
#if defined(XP_MACOSX)
|
||||
if (!CopyFileIntoUpdateDir(greDir, kUpdaterApp, updateDir))
|
||||
return PR_FALSE;
|
||||
#else
|
||||
if (!CopyFileIntoUpdateDir(greDir, kUpdaterBin, updateDir))
|
||||
return PR_FALSE;
|
||||
#endif
|
||||
CopyFileIntoUpdateDir(appDir, kUpdaterINI, updateDir);
|
||||
|
||||
// Finally, return the location of the updater binary.
|
||||
rv = updateDir->Clone(getter_AddRefs(updater));
|
||||
nsresult rv = updateDir->Clone(getter_AddRefs(updater));
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
#if defined(XP_MACOSX)
|
||||
|
|
Загрузка…
Ссылка в новой задаче