From 3dd230e8595e2b9635d6ec412a145ae3be229b7a Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Mon, 16 Jul 2012 22:32:55 -0400 Subject: [PATCH] macos: fix growlagent icon handling the whole of the api used for icon handling when you steal it from a resource fork is deprecated in new macos. fine. we'll just make an app bundle by cheating, move andy into a standalone icns file, install him into the "bundle" and open it the macos way. Change-Id: I94b3fdb5fdb08b28400bd0f6f6a18a07840124df Reviewed-on: http://gerrit.openafs.org/7786 Tested-by: BuildBot Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/platform/DARWIN/growlagent/Andy.icns | Bin 0 -> 36884 bytes src/platform/DARWIN/growlagent/CFGrowlAdditions.c | 629 ---------------------- src/platform/DARWIN/growlagent/CFGrowlAdditions.h | 86 --- src/platform/DARWIN/growlagent/CFGrowlDefines.h | 38 -- src/platform/DARWIN/growlagent/Info.plist | 42 ++ src/platform/DARWIN/growlagent/Makefile.in | 27 +- src/platform/DARWIN/growlagent/main.m | 31 +- 7 files changed, 77 insertions(+), 776 deletions(-) create mode 100644 src/platform/DARWIN/growlagent/Andy.icns delete mode 100644 src/platform/DARWIN/growlagent/CFGrowlAdditions.c delete mode 100644 src/platform/DARWIN/growlagent/CFGrowlAdditions.h delete mode 100644 src/platform/DARWIN/growlagent/CFGrowlDefines.h create mode 100644 src/platform/DARWIN/growlagent/Info.plist diff --git a/src/platform/DARWIN/growlagent/Andy.icns b/src/platform/DARWIN/growlagent/Andy.icns new file mode 100644 index 0000000000000000000000000000000000000000..7c62a76f9342396aa5560a713d028a1bb818b2d1 GIT binary patch literal 36884 zcmeIa_e0ay{y!ceA%naUmLNlcEH(rZP*D{3UbR~7(oVaV9d;*7WoU=3_S(9tGOT+8 z0o=2$I;&Q3B0~sSCVAy`K93XZ``+(g@co5*rQ$2+JYUcAoR9N-o|89Ud2c?C_g%=- zQ%1z_c)UJueyq#j@uswWJmB58dAwZFzyHQ(ylPU&*@%$ycsP!5_*KlgU60LfH~!H{ z82ZpkK%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dDc8Z9(lF zt<6p6Dn7`C0Sx)L>S}W*o*G)kH!q*8UH$dAI2Ev(Ax;D)wAJ`#H5{2w!%pK~$?4Si{p#J}9v>BTX4|+9&gMZs>ycR=ia9fADv-98w z10W5xB3d!73g4oFFD3#wCfI%=4$%uNNd4V6vy3*Mt}c8T$G<%{0}Eu2@WLTBjvYK; z@Wcf>+mWZ}Erfq>X3+|R -#include -#include -#include -#include -#include "CFGrowlAdditions.h" - -#ifndef MIN -# define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - -//extern Boolean CFStringGetFileSystemRepresentation(CFStringRef str) __attribute__((weak_import)); -extern CFIndex CFStringGetMaximumSizeOfFileSystemRepresentation(CFStringRef string) __attribute__((weak_import)); - -char *createFileSystemRepresentationOfString(CFStringRef str) { - char *buffer; -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 - /* CFStringGetFileSystemRepresentation will cause a link error despite the weak_import attribute above on 10.5 when compiling with 10.2 compatibility using gcc 3.3. - * PPC will therefore always use the 10.3 and below method of creating a file system representation. - */ - if (1/*CFStringGetFileSystemRepresentation*/) { - CFIndex size = CFStringGetMaximumSizeOfFileSystemRepresentation(str); - buffer = malloc(size); - CFStringGetFileSystemRepresentation(str, buffer, size); - } else -#endif - { - buffer = malloc(512); - CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, str, kCFURLPOSIXPathStyle, false); - if (!CFURLGetFileSystemRepresentation(url, false, (UInt8 *)buffer, 512)) { - free(buffer); - buffer = NULL; - } - CFRelease(url); - } - return buffer; -} - -STRING_TYPE createStringWithDate(CFDateRef date) { - CFLocaleRef locale = CFLocaleCopyCurrent(); - CFDateFormatterRef dateFormatter = CFDateFormatterCreate(kCFAllocatorDefault, - locale, - kCFDateFormatterMediumStyle, - kCFDateFormatterMediumStyle); - CFRelease(locale); - CFStringRef dateString = CFDateFormatterCreateStringWithDate(kCFAllocatorDefault, - dateFormatter, - date); - CFRelease(dateFormatter); - return dateString; -} - -STRING_TYPE createStringWithContentsOfFile(CFStringRef filename, CFStringEncoding encoding) { - CFStringRef str = NULL; - - char *path = createFileSystemRepresentationOfString(filename); - if (path) { - FILE *fp = fopen(path, "rb"); - if (fp) { - fseek(fp, 0, SEEK_END); - unsigned long size = ftell(fp); - fseek(fp, 0, SEEK_SET); - unsigned char *buffer = malloc(size); - if (buffer && fread(buffer, 1, size, fp) == size) - str = CFStringCreateWithBytes(kCFAllocatorDefault, buffer, size, encoding, true); - fclose(fp); - } - free(path); - } - - return str; -} - -STRING_TYPE createStringWithStringAndCharacterAndString(STRING_TYPE str0, UniChar ch, STRING_TYPE str1) { - CFStringRef cfstr0 = (CFStringRef)str0; - CFStringRef cfstr1 = (CFStringRef)str1; - CFIndex len0 = (cfstr0 ? CFStringGetLength(cfstr0) : 0); - CFIndex len1 = (cfstr1 ? CFStringGetLength(cfstr1) : 0); - size_t length = (len0 + (ch != 0xffff) + len1); - - UniChar *buf = malloc(sizeof(UniChar) * length); - size_t i = 0U; - - if (cfstr0) { - CFStringGetCharacters(cfstr0, CFRangeMake(0, len0), buf); - i += len0; - } - if (ch != 0xffff) - buf[i++] = ch; - if (cfstr1) - CFStringGetCharacters(cfstr1, CFRangeMake(0, len1), &buf[i]); - - return CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, buf, length, /*contentsDeallocator*/ kCFAllocatorMalloc); -} - -char *copyCString(STRING_TYPE str, CFStringEncoding encoding) { - CFIndex size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), encoding) + 1; - char *buffer = calloc(size, 1); - CFStringGetCString(str, buffer, size, encoding); - return buffer; -} - -STRING_TYPE copyCurrentProcessName(void) { - ProcessSerialNumber PSN = { 0, kCurrentProcess }; - CFStringRef name = NULL; - OSStatus err = CopyProcessName(&PSN, &name); - if (err != noErr) { - NSLog(CFSTR("in copyCurrentProcessName in CFGrowlAdditions: Could not get process name because CopyProcessName returned %li"), (long)err); - name = NULL; - } - return name; -} - -URL_TYPE copyCurrentProcessURL(void) { - ProcessSerialNumber psn = { 0, kCurrentProcess }; - FSRef fsref; - CFURLRef URL = NULL; - OSStatus err = GetProcessBundleLocation(&psn, &fsref); - if (err != noErr) { - NSLog(CFSTR("in copyCurrentProcessURL in CFGrowlAdditions: Could not get application location, because GetProcessBundleLocation returned %li\n"), (long)err); - } else { - URL = CFURLCreateFromFSRef(kCFAllocatorDefault, &fsref); - } - return URL; -} -STRING_TYPE copyCurrentProcessPath(void) { - CFURLRef URL = copyCurrentProcessURL(); - CFStringRef path = CFURLCopyFileSystemPath(URL, kCFURLPOSIXPathStyle); - CFRelease(URL); - return path; -} - -URL_TYPE copyTemporaryFolderURL(void) { - FSRef ref; - CFURLRef url = NULL; - - OSStatus err = FSFindFolder(kOnAppropriateDisk, kTemporaryFolderType, kCreateFolder, &ref); - if (err != noErr) - NSLog(CFSTR("in copyTemporaryFolderPath in CFGrowlAdditions: Could not locate temporary folder because FSFindFolder returned %li"), (long)err); - else - url = CFURLCreateFromFSRef(kCFAllocatorDefault, &ref); - - return url; -} -STRING_TYPE copyTemporaryFolderPath(void) { - CFStringRef path = NULL; - - CFURLRef url = copyTemporaryFolderURL(); - if (url) { - path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); - CFRelease(url); - } - - return path; -} - -DATA_TYPE readFile(const char *filename) -{ - CFDataRef data; - // read the file into a CFDataRef - FILE *fp = fopen(filename, "r"); - if (fp) { - fseek(fp, 0, SEEK_END); - long dataLength = ftell(fp); - fseek(fp, 0, SEEK_SET); - unsigned char *fileData = malloc(dataLength); - fread(fileData, 1, dataLength, fp); - fclose(fp); - data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, fileData, dataLength, kCFAllocatorMalloc); - } else - data = NULL; - - return data; -} - -URL_TYPE copyURLForApplication(STRING_TYPE appName) -{ - CFURLRef appURL = NULL; - OSStatus err = LSFindApplicationForInfo(/*inCreator*/ kLSUnknownCreator, - /*inBundleID*/ NULL, - /*inName*/ appName, - /*outAppRef*/ NULL, - /*outAppURL*/ &appURL); - return (err == noErr) ? appURL : NULL; -} - -STRING_TYPE createStringWithAddressData(DATA_TYPE aAddressData) { - struct sockaddr *socketAddress = (struct sockaddr *)CFDataGetBytePtr(aAddressData); - // IPv6 Addresses are "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF" - // at max, which is 40 bytes (0-terminated) - // IPv4 Addresses are "255.255.255.255" at max which is smaller - char stringBuffer[40]; - CFStringRef addressAsString = NULL; - if (socketAddress->sa_family == AF_INET) { - struct sockaddr_in *ipv4 = (struct sockaddr_in *)socketAddress; - if (inet_ntop(AF_INET, &(ipv4->sin_addr), stringBuffer, 40)) - addressAsString = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%s:%d"), stringBuffer, ipv4->sin_port); - else - addressAsString = CFSTR("IPv4 un-ntopable"); - } else if (socketAddress->sa_family == AF_INET6) { - struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)socketAddress; - if (inet_ntop(AF_INET6, &(ipv6->sin6_addr), stringBuffer, 40)) - // Suggested IPv6 format (see http://www.faqs.org/rfcs/rfc2732.html) - addressAsString = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("[%s]:%d"), stringBuffer, ipv6->sin6_port); - else - addressAsString = CFSTR("IPv6 un-ntopable"); - } else - addressAsString = CFSTR("neither IPv6 nor IPv4"); - - return addressAsString; -} - -STRING_TYPE createHostNameForAddressData(DATA_TYPE aAddressData) { - char hostname[NI_MAXHOST]; - struct sockaddr *socketAddress = (struct sockaddr *)CFDataGetBytePtr(aAddressData); - if (getnameinfo(socketAddress, (socklen_t)CFDataGetLength(aAddressData), - hostname, (socklen_t)sizeof(hostname), - /*serv*/ NULL, /*servlen*/ 0, - NI_NAMEREQD)) - return NULL; - else - return CFStringCreateWithCString(kCFAllocatorDefault, hostname, kCFStringEncodingASCII); -} - -DATA_TYPE copyIconDataForPath(STRING_TYPE path) { - CFDataRef data = NULL; - - //false is probably safest, and is harmless when the object really is a directory. - CFURLRef URL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path, kCFURLPOSIXPathStyle, /*isDirectory*/ false); - if (URL) { - data = copyIconDataForURL(URL); - CFRelease(URL); - } - - return data; -} - -DATA_TYPE copyIconDataForURL(URL_TYPE URL) -{ - CFDataRef data = NULL; - - if (URL) { - FSRef ref; - if (CFURLGetFSRef(URL, &ref)) { - IconRef icon = NULL; - SInt16 label_noOneCares; - OSStatus err = GetIconRefFromFileInfo(&ref, - /*inFileNameLength*/ 0U, /*inFileName*/ NULL, - kFSCatInfoNone, /*inCatalogInfo*/ NULL, - kIconServicesNoBadgeFlag | kIconServicesUpdateIfNeededFlag, - &icon, - &label_noOneCares); - if (err != noErr) { - NSLog(CFSTR("in copyIconDataForURL in CFGrowlAdditions: could not get icon for %@: GetIconRefFromFileInfo returned %li\n"), URL, (long)err); - } else { - IconFamilyHandle fam = NULL; - err = IconRefToIconFamily(icon, kSelectorAllAvailableData, &fam); - if (err != noErr) { - NSLog(CFSTR("in copyIconDataForURL in CFGrowlAdditions: could not get icon for %@: IconRefToIconFamily returned %li\n"), URL, (long)err); - } else { - HLock((Handle)fam); - data = CFDataCreate(kCFAllocatorDefault, (const UInt8 *)*(Handle)fam, GetHandleSize((Handle)fam)); - HUnlock((Handle)fam); - DisposeHandle((Handle)fam); - } - ReleaseIconRef(icon); - } - } - } - - return data; -} - -URL_TYPE createURLByMakingDirectoryAtURLWithName(URL_TYPE parent, STRING_TYPE name) -{ - CFURLRef newDirectory = NULL; - - CFAllocatorRef allocator = parent ? CFGetAllocator(parent) : name ? CFGetAllocator(name) : kCFAllocatorDefault; - - if (parent) parent = CFRetain(parent); - else { - char *cwdBytes = alloca(PATH_MAX); - getcwd(cwdBytes, PATH_MAX); - parent = CFURLCreateFromFileSystemRepresentation(allocator, (const unsigned char *)cwdBytes, strlen(cwdBytes), /*isDirectory*/ true); - if (!name) { - newDirectory = parent; - goto end; - } - } - if (!parent) - NSLog(CFSTR("in createURLByMakingDirectoryAtURLWithName in CFGrowlAdditions: parent directory URL is NULL (please tell the Growl developers)\n"), parent); - else { - if (name) - name = CFRetain(name); - else { - name = CFURLCopyLastPathComponent(parent); - CFURLRef newParent = CFURLCreateCopyDeletingLastPathComponent(allocator, parent); - CFRelease(parent); - parent = newParent; - } - - if (!name) - NSLog(CFSTR("in createURLByMakingDirectoryAtURLWithName in CFGrowlAdditions: name of directory to create is NULL (please tell the Growl developers)\n"), parent); - else { - FSRef parentRef; - if (!CFURLGetFSRef(parent, &parentRef)) - NSLog(CFSTR("in createURLByMakingDirectoryAtURLWithName in CFGrowlAdditions: could not create FSRef for parent directory at %@ (please tell the Growl developers)\n"), parent); - else { - FSRef newDirectoryRef; - - struct HFSUniStr255 nameUnicode; - CFRange range = { 0, MIN(CFStringGetLength(name), USHRT_MAX) }; - CFStringGetCharacters(name, range, nameUnicode.unicode); - nameUnicode.length = range.length; - - struct FSRefParam refPB = { - .ref = &parentRef, - .nameLength = nameUnicode.length, - .name = nameUnicode.unicode, - .whichInfo = kFSCatInfoNone, - .catInfo = NULL, - .textEncodingHint = kTextEncodingUnknown, - .newRef = &newDirectoryRef, - }; - - OSStatus err = PBCreateDirectoryUnicodeSync(&refPB); - if (err == dupFNErr) { - //dupFNErr == file (or folder) exists already. this is fine. - err = PBMakeFSRefUnicodeSync(&refPB); - } - if (err == noErr) { - NSLog(CFSTR("PBCreateDirectoryUnicodeSync or PBMakeFSRefUnicodeSync returned %li; calling CFURLCreateFromFSRef"), (long)err); //XXX - newDirectory = CFURLCreateFromFSRef(allocator, &newDirectoryRef); - NSLog(CFSTR("CFURLCreateFromFSRef returned %@"), newDirectory); //XXX - } else - NSLog(CFSTR("in createURLByMakingDirectoryAtURLWithName in CFGrowlAdditions: could not create directory '%@' in parent directory at %@: FSCreateDirectoryUnicode returned %li (please tell the Growl developers)"), name, parent, (long)err); - } - - } //if (name) - if(parent) - CFRelease(parent); - if(name) - CFRelease(name); - } //if (parent) - -end: - return newDirectory; -} - -#ifndef COPYFORK_BUFSIZE -# define COPYFORK_BUFSIZE 5242880U /*5 MiB*/ -#endif - -static OSStatus copyFork(const struct HFSUniStr255 *forkName, const FSRef *srcFile, const FSRef *destDir, const struct HFSUniStr255 *destName, FSRef *outDestFile) { - OSStatus err, closeErr; - struct FSForkIOParam srcPB = { - .ref = srcFile, - .forkNameLength = forkName->length, - .forkName = forkName->unicode, - .permissions = fsRdPerm, - }; - unsigned char debuggingPathBuf[PATH_MAX] = ""; - OSStatus debuggingPathErr; - - err = PBOpenForkSync(&srcPB); - if (err != noErr) { - debuggingPathErr = FSRefMakePath(srcFile, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for source file: FSRefMakePath returned %li)", (long)debuggingPathErr); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBOpenForkSync (source: %s) returned %li"), debuggingPathBuf, (long)err); - } else { - FSRef destFile; - - /*the first thing to do is get the name of the destination file, if one - * wasn't provided. - *and while we're at it, we get the catalogue info as well. - */ - struct FSCatalogInfo catInfo; - struct FSRefParam refPB = { - .ref = srcFile, - .whichInfo = kFSCatInfoGettableInfo & kFSCatInfoSettableInfo, - .catInfo = &catInfo, - .spec = NULL, - .parentRef = NULL, - .outName = destName ? NULL : (struct HFSUniStr255 *)(destName = alloca(sizeof(struct HFSUniStr255))), - }; - - err = PBGetCatalogInfoSync(&refPB); - if (err != noErr) { - debuggingPathErr = FSRefMakePath(srcFile, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for source file: FSRefMakePath returned %li)", (long)debuggingPathErr); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBGetCatalogInfoSync (source: %s) returned %li"), debuggingPathBuf, (long)err); - } else { - refPB.ref = destDir; - refPB.nameLength = destName->length; - refPB.name = destName->unicode; - refPB.textEncodingHint = kTextEncodingUnknown; - refPB.newRef = &destFile; - - const char *functionName = "PBMakeFSRefUnicodeSync"; //for error-reporting message - - err = PBMakeFSRefUnicodeSync(&refPB); - if ((err != noErr) && (err != fnfErr)) { - handleMakeFSRefError: - debuggingPathErr = FSRefMakePath(destDir, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for destination directory: FSRefMakePath returned %li)", (long)debuggingPathErr); - - //get filename too - CFStringRef debuggingFilename = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, - destName->unicode, - destName->length, - /*contentsDeallocator*/ kCFAllocatorNull); - if (!debuggingFilename) - debuggingFilename = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, "(could not get filename for destination file: CFStringCreateWithCharactersNoCopy returned NULL)", kCFStringEncodingASCII, /*contentsDeallocator*/ kCFAllocatorNull); - - NSLog(CFSTR("in copyFork in CFGrowlAdditions: %s (destination: %s/%@) returned %li"), functionName, debuggingPathBuf, debuggingFilename, (long)err); - - if (debuggingFilename) CFRelease(debuggingFilename); - } else { - //that file doesn't exist in that folder; create it. - err = PBCreateFileUnicodeSync(&refPB); - if (err == noErr) { - /*make sure the Finder knows about the new file. - *FNNotify returns a status code too, but this isn't an - * essential step, so we just ignore it. - */ - FNNotify(destDir, kFNDirectoryModifiedMessage, kNilOptions); - } else if (err == dupFNErr) { - /*dupFNErr: the file already exists. - *we can safely ignore this error. - */ - err = noErr; - } else { - functionName = "PBCreateFileUnicodeSync"; - goto handleMakeFSRefError; - } - } - } - if (err == noErr) { - if (outDestFile) - memcpy(outDestFile, &destFile, sizeof(destFile)); - - struct FSForkIOParam destPB = { - .ref = &destFile, - .forkNameLength = forkName->length, - .forkName = forkName->unicode, - .permissions = fsWrPerm, - }; - err = PBOpenForkSync(&destPB); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBOpenForkSync (dest) returned %li"), (long)err); - if (err != noErr) { - debuggingPathErr = FSRefMakePath(&destFile, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for dest file: FSRefMakePath returned %li)", (long)debuggingPathErr); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBOpenForkSync (destination: %s) returned %li"), debuggingPathBuf, (long)err); - } else { - void *buf = malloc(COPYFORK_BUFSIZE); - if (buf) { - srcPB.buffer = destPB.buffer = buf; - srcPB.requestCount = COPYFORK_BUFSIZE; - while (err == noErr) { - err = PBReadForkSync(&srcPB); - if (err == eofErr) { - err = noErr; - if (srcPB.actualCount == 0) - break; - } - if (err != noErr) { - debuggingPathErr = FSRefMakePath(&destFile, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for source file: FSRefMakePath returned %li)", (long)debuggingPathErr); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBReadForkSync (source: %s) returned %li"), debuggingPathBuf, (long)err); - } else { - destPB.requestCount = srcPB.actualCount; - err = PBWriteForkSync(&destPB); - if (err != noErr) { - debuggingPathErr = FSRefMakePath(&destFile, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for dest file: FSRefMakePath returned %li)", (long)debuggingPathErr); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBWriteForkSync (destination: %s) returned %li"), debuggingPathBuf, (long)err); - } - } - } - - free(buf); - } - - closeErr = PBCloseForkSync(&destPB); - if (closeErr != noErr) { - debuggingPathErr = FSRefMakePath(&destFile, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for dest file: FSRefMakePath returned %li)", (long)debuggingPathErr); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBCloseForkSync (destination: %s) returned %li"), debuggingPathBuf, (long)err); - } - if (err == noErr) err = closeErr; - } - } - - closeErr = PBCloseForkSync(&srcPB); - if (closeErr != noErr) { - debuggingPathErr = FSRefMakePath(&destFile, debuggingPathBuf, PATH_MAX); - if (debuggingPathErr != noErr) - snprintf((char *)debuggingPathBuf, PATH_MAX, "(could not get path for source file: FSRefMakePath returned %li)", (long)debuggingPathErr); - NSLog(CFSTR("in copyFork in CFGrowlAdditions: PBCloseForkSync (source: %s) returned %li"), debuggingPathBuf, (long)err); - } - if (err == noErr) err = closeErr; - } - - return err; -} - -static OSStatus GrowlCopyObjectSync(const FSRef *fileRef, const FSRef *destRef, FSRef *destFileRef) { - OSStatus err; - struct HFSUniStr255 forkName; - struct FSForkIOParam forkPB = { - .ref = fileRef, - .forkIterator = { - .initialize = 0 - }, - .outForkName = &forkName, - }; - - do { - err = PBIterateForksSync(&forkPB); - NSLog(CFSTR("PBIterateForksSync returned %li"), (long)err); - if (err != noErr) { - if (err != errFSNoMoreItems) - NSLog(CFSTR("in GrowlCopyObjectSync in CFGrowlAdditions: PBIterateForksSync returned %li"), (long)err); - } else { - err = copyFork(&forkName, fileRef, destRef, /*destName*/ NULL, /*outDestFile*/ destFileRef); - //copyFork prints its own error messages - } - } while (err == noErr); - if (err == errFSNoMoreItems) err = noErr; - - return err; -} - -URL_TYPE createURLByCopyingFileFromURLToDirectoryURL(URL_TYPE file, URL_TYPE dest) -{ - CFURLRef destFileURL = NULL; - - FSRef fileRef, destRef, destFileRef; - Boolean gotFileRef = CFURLGetFSRef(file, &fileRef); - Boolean gotDestRef = CFURLGetFSRef(dest, &destRef); - if (!gotFileRef) - NSLog(CFSTR("in createURLByCopyingFileFromURLToDirectoryURL in CFGrowlAdditions: CFURLGetFSRef failed with source URL %@"), file); - else if (!gotDestRef) - NSLog(CFSTR("in createURLByCopyingFileFromURLToDirectoryURL in CFGrowlAdditions: CFURLGetFSRef failed with destination URL %@"), dest); - else { - OSStatus err; - - /* - * 10.2 has a problem with weak symbols in frameworks so we use - * MAC_OS_X_VERSION_MIN_REQUIRED >= 10.3. - */ -#if defined(NSAppKitVersionNumber10_3) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3 - if (FSCopyObjectSync) { - err = FSCopyObjectSync(&fileRef, &destRef, /*destName*/ NULL, &destFileRef, kFSFileOperationOverwrite); - } else { -#endif - err = GrowlCopyObjectSync(&fileRef, &destRef, &destFileRef); -#if defined(NSAppKitVersionNumber10_3) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3 - } -#endif - - if (err == noErr) - destFileURL = CFURLCreateFromFSRef(kCFAllocatorDefault, &destFileRef); - else - NSLog(CFSTR("in createURLByCopyingFileFromURLToDirectoryURL in CFGrowlAdditions: CopyObjectSync returned %li for source URL %@"), (long)err, file); - } - - return destFileURL; -} - -PLIST_TYPE createPropertyListFromURL(URL_TYPE file, u_int32_t mutability, CFPropertyListFormat *outFormat, STRING_TYPE *outErrorString) -{ - CFPropertyListRef plist = NULL; - - if (!file) - NSLog(CFSTR("in createPropertyListFromURL in CFGrowlAdditions: cannot read from a NULL URL")); - else { - CFReadStreamRef stream = CFReadStreamCreateWithFile(kCFAllocatorDefault, file); - if (!stream) - NSLog(CFSTR("in createPropertyListFromURL in CFGrowlAdditions: could not create stream for reading from URL %@"), file); - else { - if (!CFReadStreamOpen(stream)) - NSLog(CFSTR("in createPropertyListFromURL in CFGrowlAdditions: could not open stream for reading from URL %@"), file); - else { - CFPropertyListFormat format; - CFStringRef errorString = NULL; - - plist = CFPropertyListCreateFromStream(kCFAllocatorDefault, - stream, - /*streamLength*/ 0, - mutability, - &format, - &errorString); - if (!plist) - NSLog(CFSTR("in createPropertyListFromURL in CFGrowlAdditions: could not read property list from URL %@ (error string: %@)"), file, errorString); - - if (outFormat) *outFormat = format; - if (errorString) { - if (outErrorString) - *outErrorString = errorString; - else - CFRelease(errorString); - } - - CFReadStreamClose(stream); - } - - CFRelease(stream); - } - } - - return plist; -} diff --git a/src/platform/DARWIN/growlagent/CFGrowlAdditions.h b/src/platform/DARWIN/growlagent/CFGrowlAdditions.h deleted file mode 100644 index a65d78d..0000000 --- a/src/platform/DARWIN/growlagent/CFGrowlAdditions.h +++ /dev/null @@ -1,86 +0,0 @@ -// -// CFGrowlAdditions.h -// Growl -// -// Created by Mac-arena the Bored Zo on Wed Jun 18 2004. -// Copyright 2005-2006 The Growl Project. -// -// This file is under the BSD License, refer to License.txt for details - -#ifndef HAVE_CFGROWLADDITIONS_H -#define HAVE_CFGROWLADDITIONS_H - -#include "CFGrowlDefines.h" - -//see GrowlApplicationBridge-Carbon.c for rationale of using NSLog. -extern void NSLog(STRING_TYPE format, ...); - -char *createFileSystemRepresentationOfString(STRING_TYPE str); -STRING_TYPE createStringWithDate(DATE_TYPE date); - -STRING_TYPE createStringWithContentsOfFile(STRING_TYPE filename, CFStringEncoding encoding); - -//you can leave out any of these three components. to leave out the character, pass 0xffff. -STRING_TYPE createStringWithStringAndCharacterAndString(STRING_TYPE str0, UniChar ch, STRING_TYPE str1); - -char *copyCString(STRING_TYPE str, CFStringEncoding encoding); - -STRING_TYPE copyCurrentProcessName(void); -URL_TYPE copyCurrentProcessURL(void); -STRING_TYPE copyCurrentProcessPath(void); - -URL_TYPE copyTemporaryFolderURL(void); -STRING_TYPE copyTemporaryFolderPath(void); - -STRING_TYPE createStringWithAddressData(DATA_TYPE aAddressData); -STRING_TYPE createHostNameForAddressData(DATA_TYPE aAddressData); - -DATA_TYPE readFile(const char *filename); -URL_TYPE copyURLForApplication(STRING_TYPE appName); - -/* @function copyIconDataForPath - * @param path The POSIX path to the file or folder whose icon you want. - * @result The icon data, in IconFamily format (same as used in the 'icns' resource and in .icns files). You are responsible for releasing this object. - */ -DATA_TYPE copyIconDataForPath(STRING_TYPE path); -/* @function copyIconDataForURL - * @param URL The URL to the file or folder whose icon you want. - * @result The icon data, in IconFamily format (same as used in the 'icns' resource and in .icns files). You are responsible for releasing this object. - */ -DATA_TYPE copyIconDataForURL(URL_TYPE URL); - -/* @function createURLByMakingDirectoryAtURLWithName - * @abstract Create a directory. - * @discussion This function has a useful side effect: if you pass - * NULL for both parameters, this function will act basically as - * CFURL version of getcwd(3). - * - * Also, for CF clients: the allocator used to create the returned URL will - * be the allocator for the parent URL, the allocator for the name string, or - * the default allocator, in that order of preference. - * @param parent The directory in which to create the new directory. If this is NULL, the current working directory (as returned by getcwd(3)) will be used. - * @param name The name of the directory you want to create. If this is NULL, the directory specified by the URL will be created. - * @result The URL for the directory if it was successfully created (in which case, you are responsible for releasing this object); else, NULL. - */ -URL_TYPE createURLByMakingDirectoryAtURLWithName(URL_TYPE parent, STRING_TYPE name); - -/* @function createURLByCopyingFileFromURLToDirectoryURL - * @param file The file to copy. - * @param dest The folder to copy it to. - * @result The copy. You are responsible for releasing this object. - */ -URL_TYPE createURLByCopyingFileFromURLToDirectoryURL(URL_TYPE file, URL_TYPE dest); - -/* @function createPropertyListFromURL - * @abstract Reads a property list from the contents of an URL. - * @discussion Creates a property list from the data at an URL (for example, a - * file URL), and returns it. - * @param file The file to read. - * @param mutability A mutability-option constant indicating whether the property list (and possibly its contents) should be mutable. - * @param outFormat If the property list is read successfully, this will point to the format of the property list. You may pass NULL if you are not interested in this information. If the property list is not read successfully, the value at this pointer will be left unchanged. - * @param outErrorString If an error occurs, this will point to a string (which you are responsible for releasing) describing the error. You may pass NULL if you are not interested in this information. If no error occurs, the value at this pointer will be left unchanged. - * @result The property list. You are responsible for releasing this object. - */ -PLIST_TYPE createPropertyListFromURL(URL_TYPE file, u_int32_t mutability, CFPropertyListFormat *outFormat, STRING_TYPE *outErrorString); - -#endif diff --git a/src/platform/DARWIN/growlagent/CFGrowlDefines.h b/src/platform/DARWIN/growlagent/CFGrowlDefines.h deleted file mode 100644 index da7c17c..0000000 --- a/src/platform/DARWIN/growlagent/CFGrowlDefines.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// CFURLDefines.h -// Growl -// -// Created by Ingmar Stein on Fri Sep 16 2005. -// Copyright 2005-2006 The Growl Project. All rights reserved. -// -// This file is under the BSD License, refer to License.txt for details - -#ifndef HAVE_CFGROWLDEFINES_H -#define HAVE_CFGROWLDEFINES_H - -#ifdef __OBJC__ -# define DATA_TYPE NSData * -# define DATE_TYPE NSDate * -# define DICTIONARY_TYPE NSDictionary * -# define MUTABLE_DICTIONARY_TYPE NSMutableDictionary * -# define STRING_TYPE NSString * -# define ARRAY_TYPE NSArray * -# define URL_TYPE NSURL * -# define PLIST_TYPE NSObject * -# define OBJECT_TYPE id -# define BOOL_TYPE BOOL -#else -# include -# define DATA_TYPE CFDataRef -# define DATE_TYPE CFDateRef -# define DICTIONARY_TYPE CFDictionaryRef -# define MUTABLE_DICTIONARY_TYPE CFMutableDictionaryRef -# define STRING_TYPE CFStringRef -# define ARRAY_TYPE CFArrayRef -# define URL_TYPE CFURLRef -# define PLIST_TYPE CFPropertyListRef -# define OBJECT_TYPE CFTypeRef -# define BOOL_TYPE Boolean -#endif - -#endif diff --git a/src/platform/DARWIN/growlagent/Info.plist b/src/platform/DARWIN/growlagent/Info.plist new file mode 100644 index 0000000..2733788 --- /dev/null +++ b/src/platform/DARWIN/growlagent/Info.plist @@ -0,0 +1,42 @@ + + + + + BuildMachineOSBuild + 11E2620 + CFBundleDevelopmentRegion + English + CFBundleExecutable + growlagent-openafs + CFBundleIdentifier + org.openafs.network.growlagent-openafs + CFBundleIconFile + Andy.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + DTCompiler + + DTPlatformBuild + 4E3002 + DTPlatformVersion + GM + DTSDKBuild + 11E52 + DTSDKName + macosx10.7 + DTXcode + 0433 + DTXcodeBuild + 4E3002 + LSUIElement + + NSPrincipalClass + NSApplication + + diff --git a/src/platform/DARWIN/growlagent/Makefile.in b/src/platform/DARWIN/growlagent/Makefile.in index 20d765a..35adc4c 100644 --- a/src/platform/DARWIN/growlagent/Makefile.in +++ b/src/platform/DARWIN/growlagent/Makefile.in @@ -2,32 +2,31 @@ srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.pthread -OBJS=main.o CFGrowlAdditions.o +OBJS=main.o all: growlagent-openafs -_growlagent-openafs: ${OBJS} +growlagent-openafs: ${OBJS} $(AFS_LDRULE) ${OBJS} -framework Security \ -framework AppKit -framework CoreFoundation -growlagent-openafs: _growlagent-openafs - ${CP} $? $@ - Rez -o $@ growlagent.r - SetFile -a "C" $@ - -CFGrowlAdditions.o: CFGrowlAdditions.h -main.o: GrowlDefines.h GrowlPathway.h CFGrowlAdditions.h +main.o: GrowlDefines.h GrowlPathway.h clean: - $(RM) -f *.o growlagent-openafs _growlagent-openafs + $(RM) -f *.o growlagent-openafs install: dest: \ - ${DEST}/tools/growlagent-openafs - -${DEST}/tools/growlagent-openafs: growlagent-openafs - ${INSTALL} $? $@ + ${DEST}/tools/growlagent-openafs.app + +${DEST}/tools/growlagent-openafs.app: growlagent-openafs + -mkdir -p $@ + -mkdir -p $@/Contents/Resources/MacOS + -mkdir -p $@/Contents/MacOS + ${INSTALL} $? $@/Contents/MacOS + ${INSTALL} ${srcdir}/Andy.icns $@/Contents/Resources + ${INSTALL} ${srcdir}/Info.plist $@/Contents include ../../../config/Makefile.version diff --git a/src/platform/DARWIN/growlagent/main.m b/src/platform/DARWIN/growlagent/main.m index c269623..a39f77a 100644 --- a/src/platform/DARWIN/growlagent/main.m +++ b/src/platform/DARWIN/growlagent/main.m @@ -20,9 +20,9 @@ */ #import +#import #import "GrowlDefines.h" #import "GrowlPathway.h" -#include "CFGrowlAdditions.h" #include #include @@ -168,19 +168,32 @@ static void MySocketReadCallBack(CFSocketRef socket, CFSocketCallBackType callba } } +CFDataRef readFile(const char *filename) +{ + CFDataRef data; + // read the file into a CFDataRef + FILE *fp = fopen(filename, "r"); + if (fp) { + fseek(fp, 0, SEEK_END); + long dataLength = ftell(fp); + fseek(fp, 0, SEEK_SET); + unsigned char *fileData = malloc(dataLength); + fread(fileData, 1, dataLength, fp); + fclose(fp); + data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, fileData, dataLength, kCFAllocatorMalloc); + } else + data = NULL; + + return data; +} + int main(int argc, const char **argv) { BOOL wait = NO; int code = EXIT_SUCCESS; CFDataRef icon = NULL; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - // get icon data for application name - char *selfPath; - getPath(&selfPath); - CFStringRef appPath = CFStringCreateWithCString(kCFAllocatorDefault, selfPath, kCFStringEncodingUTF8); - NSURL *appURL = [NSURL fileURLWithPath:(NSString *)appPath]; - icon = (CFDataRef)copyIconDataForURL(appURL); - free(selfPath); + NSString* myImage = [[NSBundle mainBundle] pathForResource:@"Andy" ofType:@"icns"]; + icon = (CFDataRef) readFile([myImage UTF8String]); // Register with Growl CFStringRef name = NOTIFICATION_NAME; -- 1.9.4