path vs. filename..

  • So....

    By the way thank you to everyoone who sent email helping me with the
    FSCopyObjectAsync... truly was a great help!

    Before I roll my own--is there a class method that I can use that
    will allow me to separate a path from a filename? For example when I
    use NSOpenPanel and use the filename method -- I can a fully
    qualified path to the file including the filename. I want to pull the
    path away. Do I just do some nice string manipulation to do what I
    want or is there a better considered way?

    I looked through the API and saw things that might work--but it was
    using the URL class. I didn't think that was an attractive way to go.

    Thougths?

    -mark=
  • On 26/10/2006, at 12:28 PM, Mark Manes wrote:

    > So....
    >
    > By the way thank you to everyoone who sent email helping me with
    > the FSCopyObjectAsync... truly was a great help!
    >
    > Before I roll my own--is there a class method that I can use that
    > will allow me to separate a path from a filename? For example when
    > I use NSOpenPanel and use the filename method -- I can a fully
    > qualified path to the file including the filename. I want to pull
    > the path away. Do I just do some nice string manipulation to do
    > what I want or is there a better considered way?

    See -[NSString lastPathComponent],  -[NSString
    stringByDeletingLastPathComponent] et al.

    - Chris
  • Am 26.10.2006 um 04:28 schrieb Mark Manes:
    > Before I roll my own--is there a class method that I can use that
    > will allow me to separate a path from a filename? For example when
    > I use NSOpenPanel and use the filename method -- I can a fully
    > qualified path to the file including the filename. I want to pull
    > the path away. Do I just do some nice string manipulation to do
    > what I want or is there a better considered way?

      For the archives: If you want to *display* the path or filename
    instead of just use it, use displayNameAtPath: and
    componentsToDisplayForPath:. They're in NSFileManager. Otherwise you
    won't get the correct localized file names on foreign systems, and
    the colons and slashes will be swapped compared to how the Finder
    displays them, and the disk name will be missing.

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de
previous month october 2006 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