summaryrefslogtreecommitdiff
path: root/indra/mac_updater
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-04-28 13:37:21 -0400
committerLoren Shih <seraph@lindenlab.com>2010-04-28 13:37:21 -0400
commit29e1804139691229a887144b612f147e1c9dcffb (patch)
treeef7b33360da228b7f2e078dbea5af763c1548230 /indra/mac_updater
parent26d324a2dd06ebde896f7856622a55414eb75d77 (diff)
parent96df3f3eb1351973d140ba73b507de44b1052c89 (diff)
automated merge
Diffstat (limited to 'indra/mac_updater')
-rw-r--r--indra/mac_updater/CMakeLists.txt14
-rw-r--r--indra/mac_updater/mac_updater.cpp57
2 files changed, 14 insertions, 57 deletions
diff --git a/indra/mac_updater/CMakeLists.txt b/indra/mac_updater/CMakeLists.txt
index 57d426aa24..44f98e5e18 100644
--- a/indra/mac_updater/CMakeLists.txt
+++ b/indra/mac_updater/CMakeLists.txt
@@ -15,24 +15,10 @@ include_directories(
set(mac_updater_SOURCE_FILES
mac_updater.cpp
- FSCopyObject.c
- GenLinkedList.c
- MoreFilesX.c
)
set(mac_updater_HEADER_FILES
CMakeLists.txt
-
- FSCopyObject.h
- GenLinkedList.h
- MoreFilesX.h
- )
-
-set_source_files_properties(
- FSCopyObject.c
- MoreFilesX.c
- PROPERTIES
- COMPILE_FLAGS -Wno-deprecated-declarations
)
set_source_files_properties(${mac_updater_HEADER_FILES}
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);