summaryrefslogtreecommitdiff
path: root/indra/mac_updater/mac_updater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/mac_updater/mac_updater.cpp')
-rw-r--r--indra/mac_updater/mac_updater.cpp57
1 files changed, 14 insertions, 43 deletions
diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp
index d2a46d4338..44f002aecf 100644
--- a/indra/mac_updater/mac_updater.cpp
+++ b/indra/mac_updater/mac_updater.cpp
@@ -48,9 +48,6 @@
#include <Carbon/Carbon.h>
-#include "MoreFilesX.h"
-#include "FSCopyObject.h"
-
#include "llerrorcontrol.h"
enum
@@ -547,20 +544,6 @@ bool isDirWritable(FSRef &dir)
return result;
}
-static void utf8str_to_HFSUniStr255(HFSUniStr255 *dest, const char* src)
-{
- llutf16string utf16str = utf8str_to_utf16str(src);
-
- dest->length = utf16str.size();
- if(dest->length > 255)
- {
- // There's onl room for 255 chars in a HFSUniStr25..
- // Truncate to avoid stack smaching or other badness.
- dest->length = 255;
- }
- memcpy(dest->unicode, utf16str.data(), sizeof(UniChar)* dest->length); /* Flawfinder: ignore */
-}
-
static std::string HFSUniStr255_to_utf8str(const HFSUniStr255* src)
{
llutf16string string16((U16*)&(src->unicode), src->length);
@@ -584,19 +567,12 @@ int restoreObject(const char* aside, const char* target, const char* path, const
llinfos << "Copying " << source << " to " << dest << llendl;
- err = FSCopyObject(
+ err = FSCopyObjectSync(
&sourceRef,
&destRef,
- 0,
- kFSCatInfoNone,
- kDupeActionReplace,
- NULL,
- false,
- false,
NULL,
NULL,
- NULL,
- NULL);
+ kFSFileOperationOverwrite);
if(err != noErr) return false;
return true;
@@ -779,21 +755,21 @@ void *updatethreadproc(void*)
// so we need to go up 3 levels to get the path to the main application bundle.
if(err == noErr)
{
- err = FSGetParentRef(&myBundle, &targetRef);
+ err = FSGetCatalogInfo(&myBundle, kFSCatInfoNone, NULL, NULL, NULL, &targetRef);
}
if(err == noErr)
{
- err = FSGetParentRef(&targetRef, &targetRef);
+ err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetRef);
}
if(err == noErr)
{
- err = FSGetParentRef(&targetRef, &targetRef);
+ err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetRef);
}
// And once more to get the parent of the target
if(err == noErr)
{
- err = FSGetParentRef(&targetRef, &targetParentRef);
+ err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetParentRef);
}
if(err == noErr)
@@ -1077,14 +1053,16 @@ void *updatethreadproc(void*)
char aside[MAX_PATH]; /* Flawfinder: ignore */
// this will hold the name of the destination target
- HFSUniStr255 appNameUniStr;
+ CFStringRef appNameRef;
if(replacingTarget)
{
// Get the name of the target we're replacing
+ HFSUniStr255 appNameUniStr;
err = FSGetCatalogInfo(&targetRef, 0, NULL, &appNameUniStr, NULL, NULL);
if(err != noErr)
throw 0;
+ appNameRef = FSCreateStringFromHFSUniStr(NULL, &appNameUniStr);
// Move aside old version (into work directory)
err = FSMoveObject(&targetRef, &tempDirRef, &asideRef);
@@ -1099,7 +1077,7 @@ void *updatethreadproc(void*)
// Construct the name of the target based on the product name
char appName[MAX_PATH]; /* Flawfinder: ignore */
snprintf(appName, sizeof(appName), "%s.app", gProductName);
- utf8str_to_HFSUniStr255( &appNameUniStr, appName );
+ appNameRef = CFStringCreateWithCString(NULL, appName, kCFStringEncodingUTF8);
}
sendProgress(0, 0, CFSTR("Copying files..."));
@@ -1107,19 +1085,12 @@ void *updatethreadproc(void*)
llinfos << "Starting copy..." << llendl;
// Copy the new version from the disk image to the target location.
- err = FSCopyObject(
+ err = FSCopyObjectSync(
&sourceRef,
&targetParentRef,
- 0,
- kFSCatInfoNone,
- kDupeActionStandard,
- &appNameUniStr,
- false,
- false,
- NULL,
- NULL,
+ appNameRef,
&targetRef,
- NULL);
+ kFSFileOperationDefaultOptions);
// Grab the path for later use.
err = FSRefMakePath(&targetRef, (UInt8*)target, sizeof(target));
@@ -1131,7 +1102,7 @@ void *updatethreadproc(void*)
if(err != noErr)
{
// Something went wrong during the copy. Attempt to put the old version back and bail.
- (void)FSDeleteObjects(&targetRef);
+ (void)FSDeleteObject(&targetRef);
if(replacingTarget)
{
(void)FSMoveObject(&asideRef, &targetParentRef, NULL);