forked from mirrors/gecko-dev
Bug 436719: Read updater.ini from app dir, not gre. r=bsmedberg, r=robstrong
This commit is contained in:
parent
cdc8977689
commit
6f677b86d0
4 changed files with 40 additions and 42 deletions
|
|
@ -601,6 +601,7 @@ components/websrvcs.xpt
|
||||||
components/widget_mac.xpt
|
components/widget_mac.xpt
|
||||||
components/xml-rpc.xpt
|
components/xml-rpc.xpt
|
||||||
components/xpcom_obsolete.xpt
|
components/xpcom_obsolete.xpt
|
||||||
|
updater.app/Contents/MacOS/updater.ini
|
||||||
init.d/README
|
init.d/README
|
||||||
redo-prebinding.sh
|
redo-prebinding.sh
|
||||||
res/viewer.properties
|
res/viewer.properties
|
||||||
|
|
|
||||||
|
|
@ -308,14 +308,10 @@ libs:: $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini)
|
||||||
ifeq ($(OS_ARCH),WINNT)
|
ifeq ($(OS_ARCH),WINNT)
|
||||||
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
||||||
iconv -f UTF-8 -t $(WIN_INSTALLER_CHARSET) > $(FINAL_TARGET)/updater.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
|
else
|
||||||
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
|
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef MOZ_CRASHREPORTER
|
ifdef MOZ_CRASHREPORTER
|
||||||
libs:: $(addprefix $(LOCALE_SRCDIR)/,crashreporter/crashreporter-override.ini)
|
libs:: $(addprefix $(LOCALE_SRCDIR)/,crashreporter/crashreporter-override.ini)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
static float sProgressVal; // between 0 and 100
|
static float sProgressVal; // between 0 and 100
|
||||||
static BOOL sQuit = FALSE;
|
static BOOL sQuit = FALSE;
|
||||||
static StringTable sLabels;
|
static StringTable sLabels;
|
||||||
static const char *sProgramPath;
|
static const char *sUpdatePath;
|
||||||
|
|
||||||
@interface UpdaterUI : NSObject
|
@interface UpdaterUI : NSObject
|
||||||
{
|
{
|
||||||
|
|
@ -112,7 +112,7 @@ static const char *sProgramPath;
|
||||||
int
|
int
|
||||||
InitProgressUI(int *pargc, char ***pargv)
|
InitProgressUI(int *pargc, char ***pargv)
|
||||||
{
|
{
|
||||||
sProgramPath = (*pargv)[0];
|
sUpdatePath = (*pargv)[1];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ ShowProgressUI()
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
snprintf(path, sizeof(path), "%s.ini", sProgramPath);
|
snprintf(path, sizeof(path), "%s/updater.ini", sUpdatePath);
|
||||||
if (ReadStrings(path, &sLabels) != OK)
|
if (ReadStrings(path, &sLabels) != OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -275,28 +275,13 @@ SetStatus(nsILocalFile *statusFile, const char *status)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRBool
|
static PRBool
|
||||||
CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
CopyFileIntoUpdateDir(nsIFile *parentDir, const char *leafName, nsIFile *updateDir)
|
||||||
nsCOMPtr<nsIFile> &updater)
|
|
||||||
{
|
{
|
||||||
// We have to move the updater binary and its resource file.
|
nsDependentCString leaf(leafName);
|
||||||
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);
|
|
||||||
nsCOMPtr<nsIFile> file;
|
nsCOMPtr<nsIFile> file;
|
||||||
|
|
||||||
// Make sure there is not an existing file in the target location.
|
// 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))
|
if (NS_FAILED(rv))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
rv = file->AppendNative(leaf);
|
rv = file->AppendNative(leaf);
|
||||||
|
|
@ -305,19 +290,35 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
||||||
file->Remove(PR_FALSE);
|
file->Remove(PR_FALSE);
|
||||||
|
|
||||||
// Now, copy into the target location.
|
// Now, copy into the target location.
|
||||||
rv = greDir->Clone(getter_AddRefs(file));
|
rv = parentDir->Clone(getter_AddRefs(file));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
rv = file->AppendNative(leaf);
|
rv = file->AppendNative(leaf);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
rv = file->CopyToNative(updateDir, EmptyCString());
|
rv = file->CopyToNative(updateDir, EmptyCString());
|
||||||
if (*leafName != kUpdaterINI && NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return PR_FALSE;
|
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.
|
// 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))
|
if (NS_FAILED(rv))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue