Hello to all members and developers.

Thank you for keeping Growl a great and essential tool for Mac users,
especially us "switchers"!

I am an inexperienced Xcode programmer, and just today finished
"porting" some old code from Visual C++ (Windows) of a personal
reminder tool that I wanted to use on Mac (10.6.x).

Thanks to Growl, I don't have to design "balloon notifications" (à la
Windows toolbar) so for my tool, Growl is *essential* to be present in
the system (otherwise I have to use ugly dialog messages!)

In the Growl developer's documentation page, there is only (sample)
code to check if the Growl.framework is loaded OK by the application,
then self-register as the Growl delegate.

What is *not* mentioned, is how to check a system-wide installation of
Growl.

I personally did it the "newbie" way and wanted to ask the developers
for a more "official" solution!

My code checks for the presence of two Growl files in /private/var/db/
receipts/ that are supposedly created after a *proper* installation of
Growl (probably 1.2.1 at least) in AppDelegate.m:


+(void)initialize
{
        // Check if Growl is installed
        NSString *growlBOMPath = @"/private/var/db/receipts/
com.growl.growl.pkg.bom";
        NSString *growlReceiptPath = @"/private/var/db/receipts/
com.growl.growl.pkg.plist";

        NSData *growlBOMData = [NSData dataWithContentsOfFile:growlBOMPath];
        NSData *growlReceiptData = [NSData
dataWithContentsOfFile:growlReceiptPath];

        if (![growlBOMData length] || ![growlReceiptData length])
        {
                // Growl is not (properly) installed
                NSAlert *warnCalendar = [NSAlert alertWithMessageText:
[[NSRunningApplication currentApplication] localizedName]
defaultButton: @"Exit" alternateButton: nil otherButton: nil
informativeTextWithFormat: @""];
                [warnCalendar setAlertStyle:NSCriticalAlertStyle];
                [warnCalendar setInformativeText: @"Growl framework was not 
found on
your system! Please install Growl frist from www.growl.info!"];

                // Display warning then terminate application
                [warnCalendar runModal];
                [NSApp terminate:self];
        }
        else
        {
                // Growl is apparently installed
                NSLog(@"File com.growl.growl.pkg.bom has size %i bytes",
[growlBOMData length]);
                NSLog(@"File com.growl.growl.pkg.plist has size %i bytes",
[growlReceiptData length]);
        }
}


A solution for a proper and more viable (and update-robust) solution
is very appreciated! Hopefully this can be added to the Growl
developers documentation!

Thanks to all.

Regards from Athens, Greece
Konstantinos

-- 
You received this message because you are subscribed to the Google Groups 
"Growl Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/growldiscuss?hl=en.

Reply via email to