On 12 Aug 2011, at 12:29 AM, Wilker wrote:

> I'm trying to accept folder drops on dock icon, but I can't find how to do
> it...
> I'm already receiving some file types (I just had to declare them on
> Document Types), but I can't find where I configure it for accepting folders
> too...

I have a project that does this, but it's _very_ old (Tiger, 2007), so if 
there's a better way, I hope someone will chime in...

In the Info tab of the Target editor (Xcode 4), declare a folder document type. 
Set LSTypeIsPackage to NO, and CFBundleOSTypes to a single element, 'fold'.

My app was non-document, and handled only folders, so my application delegate 
had the method

- (BOOL) application: (NSApplication *) theApp
            openFile: (NSString *) aPath
{
    NSFileManager *     fm = [NSFileManager defaultManager];
    BOOL                isDirectory;
    
    if ([fm fileExistsAtPath: aPath isDirectory: &isDirectory] && isDirectory) {
        [[NSDocumentController sharedDocumentController]
         noteNewRecentDocumentURL: [NSURL fileURLWithPath: aPath]];
        [self setDirectory: aPath];
        return YES;
    }
    else
        return NO;
}

Probably you should be looking for the UTI public.directory instead.


        — F

_______________________________________________

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

Reply via email to