Re: What are the official limits of Cocoa when it comes to the length of path names?
Re: What are the official limits of Cocoa when it comes to the length of path names?
- Subject: Re: What are the official limits of Cocoa when it comes to the length of path names?
- From: Stephane Sudre <email@hidden>
- Date: Fri, 13 Jul 2007 14:47:39 +0200
On 13 juil. 07, at 14:06, Alastair Houghton wrote:
On 13 Jul 2007, at 11:36, Stéphane Sudre wrote:
Plain path names are always problematic. You should try and use
higher level abstractions like NSURL/CFURL or FSRef where possible.
For drag and dropping of files, a Text Field is not the best choice,
and if only for the reason that the HIG recommends to avoid showing
file paths to the user.
I agree with you. The problem here is that I didn't write any line of
code (this project is code free) to make this happen. The limitation
is in the Cocoa framework.
Well it may actually be in the kernel. If it's in the framework then
it should be fixed, since there's no reason for the framework to limit
the length of a path.
Well, I'm not sure this is in the Kernel since the CoreCarbon APIs look
to be working fine. But since the open calls all end into a syscall
with one of the parameter being the file path, if the FSRef APIs are
built on top of that, it could be.
Example:
--------
I have a file named "toto.jpg" on my Desktop.
I also have a subfolder hierarchy of 20 folders whose name is 250 bytes
long.
1. I create an Alias for the toto file and store it into an AliasHandle.
2. I move the toto file from the Desktop to the last folder in the
subfolder hierarchy (*)
3. I resolve the AliasHandle with FSMatchAlias. It works.
4. I update the AliasHandle with FSUpdateAlias. It works. I have a
valid FSRef.
5. I try to convert the FSRef to a NSURL using CFURLCreateFromFSRef. It
fails.
I filed an enhancement request on Bug Reporter.
(*) One thing worth noticing is that after you moved the file to its
new location, you can now longer open the file in Preview
(double-clicking the icon will launch Preview but not open the file),
you can no longer move it to another location using the Finder.
Basically, if you're an end user, you can say bye-bye to your file.
_______________________________________________
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