Re: Correct way to tell if a path is to a .bundle?

2009-09-25 Thread Brad Goss

Rick,

You could also use:
NSBundle pluginBundle = [NSBundle bundleWithPath: fullPath];

This will return an NSBundle object as your require or nil if fullPath  
does not identify an accessible bundle directory. So...

if ( pluginBundle == nil ) ... then it is not a valid bundle.

You will also want to create a protocol that the plugin's Principal  
class must conform to. So, a little snippet here for you that will  
load a valid bundle that conforms to MyPluginProtocol.


- (id)loadBundleNamed:(NSString*)bundleName {
Class exampleClass;
id newInstance;
NSString *bundlePath = [NSString stringWithFormat:@%@/ 
%...@.mypluginext,[self pluginDirectory],bundleName];

NSBundle *bundleToLoad = [NSBundle bundleWithPath:bundlePath];

if (exampleClass = [bundleToLoad principalClass]) {
		if ( [[bundleToLoad principalClass] conformsToProtocol:@protocol 
(MyPluginProtocol)] ) {
			newInstance = [[exampleClass alloc] initWithPlugInController: 
[PluginController sharedManager] bundle:[NSBundle mainBundle]];
			// initWithPluginController is a method defined by  
MyPluginProtocol... so I am safe to use it

return [newInstance autorelease];
}
}

return nil;
}

Brad Goss
brad.g...@gmail.com

On 2009-09-24, at 21:41 , Rick Mann wrote:

I'm scanning a directory for plugins for my app. Given a path,  
what's the right way to tell if it's a path to a bundle?


TIA
--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/brad.goss%40gmail.com

This email sent to brad.g...@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


CalCalendarStore Breaking a Recurring Event

2009-09-18 Thread Brad Goss

Hello everyone,

I've encountered a bug/limitation with the CalCalendarStore.

The situation in a nutshell:
1) Add an event with a recurrenceRule repeating everyday for 2 days.
2) Delete the first event (could be either)
3) Now try to undo the users action by inserting the event back in.

CalCalendarStore will not insert the record back in.

When a user breaks a recurring event in iCal by deleting an event,  
iCal sends a CalUpdatedRecordsKey notification. (No  
CalDeletedRecordsKey is posted.)
When the user undos the action, iCal then posts CalUpdatedRecordsKey  
again. (No CalInsertedRecordsKey is posted.)

When I examine the events, the properties all remain unchanged...

My issue is in my App I break the recurrenceRule by deleting and event  
using CalCalendarStore removeEvent: span: error:.


This works exactly the way I would like, however when the user undos  
their action CalCalendarStore saveEvent: span: error: is used but the  
event is not re-inserted. I do not know what property to modify so it  
will take it back.


If I knew what property to update instead of deleting the event i'd do  
that, but I can't find it!


Any ideas how I should handle the situation?

Snow Leopard 10.6.1

Brad Goss
brad.g...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com