• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSavePanel does replace / in the filename with a :
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSavePanel does replace / in the filename with a :


  • Subject: Re: NSSavePanel does replace / in the filename with a :
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 18 Oct 2010 10:20:12 +0200

On 18.10.2010, at 09:54, Thorsten Lemke wrote:
> Ah - I convert the : now manually to a / for the following File Manger Calls
> (not Cocoa). That does it.

 What are you doing? Are you trying to read old preferences that contain Carbon paths? This should *not* be necessary.

-> If you're displaying file names to the user, use displayNameAtPath:. Not only does it substitute slashes for colons as needed, it also honors hidden file extensions, and shows localized names for folders on non-English operating systems. And componentsToDisplayForPath: will correctly add the hard disk name at the start, or remove /Volumes, just like the Finder does.

-> If you're accessing files, you can simply pass this "wrong" path with the colon in it to any POSIX or Cocoa call and it'll work.

-> If you're converting between POSIX/Cocoa paths and CoreServices file manager paths, use the existing conversion calls. CFURLRef includes some neat methods to let you convert between both kinds of paths. In any case, Apple's recommended format handling file paths is CFURLRef/NSURL*. Speaking in Carbon terms, that class wraps information not unlike an FSRef inside it, so it's a much faster and more efficient way of storing file references than paths (at least on 10.6 and later, where this actually got implemented). You can even get back alias-like data for storing on disk by grabbing the "bookmark data" from a NSURL.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

_______________________________________________

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

  • Follow-Ups:
    • Re: NSSavePanel does replace / in the filename with a :
      • From: Ken Thomases <email@hidden>
References: 
 >Re: NSSavePanel does replace / in the filename with a : (From: Thorsten Lemke <email@hidden>)

  • Prev by Date: Re: NSSavePanel does replace / in the filename with a :
  • Next by Date: Re: remove icon from Dock
  • Previous by thread: Re: NSSavePanel does replace / in the filename with a :
  • Next by thread: Re: NSSavePanel does replace / in the filename with a :
  • Index(es):
    • Date
    • Thread