Re: NSPasteboard: writing non-existent filename
Re: NSPasteboard: writing non-existent filename
- Subject: Re: NSPasteboard: writing non-existent filename
- From: Greg Herlihy <email@hidden>
- Date: Mon, 29 May 2006 09:02:45 -0700
- Thread-topic: NSPasteboard: writing non-existent filename
In my experience it's never a good idea to be cavalier about anything
related to the file system - because the consequences of a mistake can be
very, very bad. And while storing fictitious path names in the Pasteboard
probably won't lead to a crash - it's still not the right way to store data
in the Pasteboard.
Since the Pasteboard is a means for apps to exchange data, the apps involved
have to have a common understanding of the data being exchanged. Therefore
for an app to place a string in the pasteboard and describe the string as a
path name (NSFilesnamePboardType) - when it is not - is undermining the
integrity of the data being exchanged.
Even if the data in this case is intended solely for the application's
internal use - there is still no reason for it to use a standard Pasteboard
type to describe the string; the app should use its own identifier for its
custom type. A better idea though would be for the app to store the actual
file path as a NSFilesnamePboardType, and then to store the auxiliary
information under its own, custom type. In that way, any app interested in
the auxiliary data could still retrieve it from the Pasteboard - while any
other app interested only in the path name itself - would not be adversely
affected by the presence of the additional information.
Greg
On 5/29/06 8:30 AM, "Karim Morsy" <email@hidden> wrote:
> hi,
>
> the type I declare for the PasteBoard is NSFilesnamePboardType.
> when I write the string (path) of a file to the pasteboard, I add
> encoded information for the receiver view of the drag & drop
> operation in a prepended string (the view then parses the string,
> obtains the info and returns the correct file name).
> so for example instead of writing @"/tmp/someFile" to the pasteboard
> I do @"/***someInfo***/tmp/someFile".
> I'm getting an error message in the run log: "can't create FSRef ....".
> apart from this, things work as desired. So I was wondering, if it's
> just that error message that's displayed or if this can cause a crash ?
>
> thanks,
> Karim
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden