Re: NSOpenPanel : Resolving the file paths for symbolic links
Re: NSOpenPanel : Resolving the file paths for symbolic links
- Subject: Re: NSOpenPanel : Resolving the file paths for symbolic links
- From: Ken Thomases <email@hidden>
- Date: Mon, 8 Jun 2009 06:53:00 -0500
On Jun 8, 2009, at 5:41 AM, Arun wrote:
I have an application in which i use NSOpenPanel to select the files.
If i login as a root user (System Administrator) and then choose the
desktop
in NSOpenPanel of my application, then i will get /var/root/Desktop.
I need a way that will help me in resolving the path as
/private/var/root/Desktop from the OpenPanel.
I was going to suggest -[NSString stringByResolvingSymlinksInPath] or -
[NSString stringByStandardizingPath], but both of those are documented
as deliberately stripping a "/private" prefix if doing so leaves a
valid path. So, it seems that Apple's idea of a standard path prefers
"/var/..." to "/private/var/...". You might consider adhering to
their standard. In fact, I expect that NSOpenPanel is already using
one of the above methods behind the scenes, which is why you're
getting what you're getting.
If you really feel you have to resolve the symlink, you might try the
realpath() function of the POSIX API. You'll have to translate to
"file-system representation" and back, using -[NSString
fileSystemRepresentation] and -[NSFileManager
stringWithFileSystemRepresentation:length:].
Regards,
Ken
_______________________________________________
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