Drag and Drop from Finder to Source List

  • Hi all,

    I've already got NSTreeController working with NSOutlibeView and
    binding in a non-Core Data app but now I need some advice on how to
    one allow certain file type drops.

    I have a method that handles drops from the pasteboard for
    NSFilenamesPboardType

    What would be the best way to verify that the file the user is
    dragging is a text file, of any encoding, that is a little more robust
    than just checking the file extension. As later I will need to support
    dragging of image types too, and possibly PDFs

    I'm not sure where to look in the documentation so sorry if this is a
    simple question, im not very experienced yet!

    Thanks!

    Jonathan
  • > I've already got NSTreeController working with NSOutlibeView and
    > binding in a non-Core Data app but now I need some advice on how to
    > one allow certain file type drops.

      NSWorkspace has a method called -typeOfFile:error: ... this will
    attempt to give you the Uniform Type Identifier of a given file or an
    error explaining why it couldn't. That's better than going by
    extension, I'd imagine, though it doesn't seem perfectly robust
    itself.

    --
    I.S.
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today