Funky file URLs from drag & drop
Funky file URLs from drag & drop
- Subject: Funky file URLs from drag & drop
- From: Rick Mann <email@hidden>
- Date: Fri, 11 May 2012 16:58:38 -0700
Why am I getting URLs from a file-drag operation that look like this?
/Users/rmann/Library/Developer/Xcode/DerivedData/DataOverlay-bcjfnacanylbcychqjbfqjytdptq/Build/Products/Debug/file:/localhost/Users/rmann/Desktop/SpaceX_CCDEV2.jpg
They should just be:
/Users/rmann/Desktop/SpaceX_CCDEV2.jpg
Here's my code:
- (BOOL)
performDragOperation: (id<NSDraggingInfo>) inSender
{
NSMutableArray* files = [NSMutableArray arrayWithCapacity: inSender.numberOfValidItemsForDrop];
[inSender enumerateDraggingItemsWithOptions: 0
forView: self
classes: [NSArray arrayWithObject: [NSPasteboardItem class]]
searchOptions: nil
usingBlock:
^(NSDraggingItem* inDraggingItem,
NSInteger inIdx,
BOOL* outStop)
{
NSPasteboardItem* item = inDraggingItem.item;
NSString* path = [item stringForType: @"public.file-url"];
NSURL* url = [NSURL fileURLWithPath: path];
[files addObject: url];
}];
if ([self.delegate respondsToSelector: @selector(timelineView:didReceiveFileURLs:)])
{
[self.delegate timelineView: self didReceiveFileURLs: [files copy]];
}
return true;
}
TIA,
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden