Re: Philosophy of FSRef - way
Re: Philosophy of FSRef - way
- Subject: Re: Philosophy of FSRef - way
- From: "M. Uli Kusterer" <email@hidden>
- Date: Thu, 10 Feb 2005 17:26:13 +0100
You're aware that FSRefs are, strictly spoken, a Carbon technology,
and thus you'll probably get much better answers about this on
Carbon-Dev.
At 16:41 Uhr +0200 10.02.2005, Ruslan Zasukhin wrote:
1) It looks very weird that I cannot create Fsref for non-existing object,
Like we was able do this with FSSpec. What a great idea is behind of this?
The idea behind an FSRef is that it will stay valid even if your
file is moved around or renamed (though not across restarts).
Pathnames obviously don't work for this, and FSSpecs encode the
parent directory's ID, and thus only stay valid if the folder
*containing* your file is moved, but not if you take a file out of
its folder.
IMHO this make things much more complex.
Now I need keep together 2 objects: Fsref and Filename.
I need store them in class, send into other functions...
True. But you also had to do the same for FSSpecs. It was just that
an FSSpec was a struct wrapping both, which means every API, even if
it is only sensible to use it on existing files, had to lug around 32
bytes of filename storage (back in the System 7 days that still meant
something).
But worse is that Fsref of EXISTED object do not need name,
So I must have 2 branched of code everywhere ?
You *could* just carry around an empty name in that case, like you
could do for FSSpecs to folders. Where's the problem?
2) I do not see easy way change name of FSRef structure:
* I can extract name from FSRef using FSGetCatalogInfo()
* but how I can set back the modified name?
Use FSRenameUnicode. Or if you want to get another file in the same
folder, you'll have to use FSGetCatalogInfo() to get the parent
FSRef, and then use that generate a new FSRef for that new file in
that folder.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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