STORM-417 FIXED Port of SNOW-140 to SG 2.0 : Forced updates not working on Mac
The point of this patch is to make the Mac updater code a bit more flexible and reliable than it is right now. The issue is double: * reliability: the string comparison code on the bundle identifier is not UTF8 compliant * flexibility: the bundle identifier is hard coded to match the bundle identifier of LL viewer (i.e. com.secondlife.indra.viewer) so it can't work for another viewer (in particular, it didn't work for Snowglobe). The "bundle identifier" is one of those Mac only thing stored in the Info.plist of a "bundle" (the ".app" folder that's bundling an executable and all its resources and is seen as an application when browsing with the Mac OS X Finder). The patch fixes both issues: * compare correctly UTF8 encoded strings * allow the bundle ID to be passed as a parameter to the updater The patch has really no consequence on LL viewer. It's more a matter of having cleaner, better code. Author: Cypren Christenson Ported and reviewed by: Merov Lindenmaster
parent
cbb184d986
commit
b3f3fb6099
|
|
@ -202,6 +202,8 @@ Catherine Pfeffer
|
|||
Celierra Darling
|
||||
VWR-1274
|
||||
VWR-6975
|
||||
Cypren Christenson
|
||||
STORM-417
|
||||
Dale Glass
|
||||
VWR-120
|
||||
VWR-560
|
||||
|
|
|
|||
|
|
@ -34,4 +34,8 @@ const S32 LL_VERSION_BUILD = 0;
|
|||
|
||||
const char * const LL_CHANNEL = "Second Life Developer";
|
||||
|
||||
#if LL_DARWIN
|
||||
const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.snowglobe.viewer";
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ Boolean gCancelled = false;
|
|||
|
||||
const char *gUpdateURL;
|
||||
const char *gProductName;
|
||||
const char *gBundleID;
|
||||
|
||||
void *updatethreadproc(void*);
|
||||
|
||||
|
|
@ -329,6 +330,10 @@ int parse_args(int argc, char **argv)
|
|||
{
|
||||
gProductName = argv[j];
|
||||
}
|
||||
else if ((!strcmp(argv[j], "-bundleid")) && (++j < argc))
|
||||
{
|
||||
gBundleID = argv[j];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -355,6 +360,7 @@ int main(int argc, char **argv)
|
|||
//
|
||||
gUpdateURL = NULL;
|
||||
gProductName = NULL;
|
||||
gBundleID = NULL;
|
||||
parse_args(argc, argv);
|
||||
if (!gUpdateURL)
|
||||
{
|
||||
|
|
@ -372,6 +378,14 @@ int main(int argc, char **argv)
|
|||
{
|
||||
gProductName = "Second Life";
|
||||
}
|
||||
if (gBundleID)
|
||||
{
|
||||
llinfos << "Bundle ID is: " << gBundleID << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBundleID = "com.secondlife.indra.viewer";
|
||||
}
|
||||
}
|
||||
|
||||
llinfos << "Starting " << gProductName << " Updater" << llendl;
|
||||
|
|
@ -592,7 +606,8 @@ static bool isFSRefViewerBundle(FSRef *targetRef)
|
|||
CFURLRef targetURL = NULL;
|
||||
CFBundleRef targetBundle = NULL;
|
||||
CFStringRef targetBundleID = NULL;
|
||||
|
||||
CFStringRef sourceBundleID = NULL;
|
||||
|
||||
targetURL = CFURLCreateFromFSRef(NULL, targetRef);
|
||||
|
||||
if(targetURL == NULL)
|
||||
|
|
@ -619,7 +634,8 @@ static bool isFSRefViewerBundle(FSRef *targetRef)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(CFStringCompare(targetBundleID, CFSTR("com.secondlife.indra.viewer"), 0) == kCFCompareEqualTo)
|
||||
sourceBundleID = CFStringCreateWithCString(NULL, gBundleID, kCFStringEncodingUTF8);
|
||||
if(CFStringCompare(sourceBundleID, targetBundleID, 0) == kCFCompareEqualTo)
|
||||
{
|
||||
// This is the bundle we're looking for.
|
||||
result = true;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
// Viewer includes
|
||||
#include "llversioninfo.h"
|
||||
#include "llversionviewer.h"
|
||||
#include "llfeaturemanager.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "lltexteditor.h"
|
||||
|
|
@ -4513,6 +4514,8 @@ void LLAppViewer::launchUpdater()
|
|||
LLAppViewer::sUpdaterInfo->mUpdateExePath += update_url.asString();
|
||||
LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" -name \"";
|
||||
LLAppViewer::sUpdaterInfo->mUpdateExePath += LLAppViewer::instance()->getSecondLifeTitle();
|
||||
LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" -bundleid \"";
|
||||
LLAppViewer::sUpdaterInfo->mUpdateExePath += LL_VERSION_BUNDLE_ID;
|
||||
LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" &";
|
||||
|
||||
LL_DEBUGS("AppInit") << "Calling updater: " << LLAppViewer::sUpdaterInfo->mUpdateExePath << LL_ENDL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue