From: <ho...@us...> - 2008-02-28 17:54:03
|
Revision: 12887 http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12887&view=rev Author: hofman Date: 2008-02-28 09:53:59 -0800 (Thu, 28 Feb 2008) Log Message: ----------- Directly get data for URLs, makes no assumptions on how the URL is encoded as data. Modified Paths: -------------- trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m 2008-02-28 17:33:45 UTC (rev 12886) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m 2008-02-28 17:53:59 UTC (rev 12887) @@ -2569,21 +2569,22 @@ for (i = 0; i < iMax && noErr == err; i++) { NSURL *theURL = [URLs objectAtIndex:i]; - NSString *string = [theURL absoluteString]; - CFDataRef utf8Data = (CFDataRef)[string dataUsingEncoding:NSUTF8StringEncoding]; + CFDataRef utf8Data = CFURLCreateData(nil, (CFURLRef)theURL, kCFStringEncodingUTF8, true); // any pointer type; private to the creating application PasteboardItemID itemID = (void *)theURL; // Finder adds a file URL and destination URL for weblocs, but only a file URL for regular files // could also put a string representation of the URL, but Finder doesn't do that - - if ([theURL isFileURL]) { - err = PasteboardPutItemFlavor(carbonPboard, itemID, kUTTypeFileURL, utf8Data, kPasteboardFlavorNoFlags); + + if (NULL != utf8Data) { + if ([theURL isFileURL]) { + err = PasteboardPutItemFlavor(carbonPboard, itemID, kUTTypeFileURL, utf8Data, kPasteboardFlavorNoFlags); + } else { + err = PasteboardPutItemFlavor(carbonPboard, itemID, kUTTypeURL, utf8Data, kPasteboardFlavorNoFlags); + } + CFRelease(utf8Data); } - else { - err = PasteboardPutItemFlavor(carbonPboard, itemID, kUTTypeURL, utf8Data, kPasteboardFlavorNoFlags); - } } if (carbonPboard) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |