Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Daniel DeCovnick
Honestly, I don't care how the data is stored, as long as I've got some reliable place to store file-specific data such that it can be reliably tied to the file (cross-user/cross-computer concerns are primary, cross-platform concerns are secondary - I'm only writing this for OS X

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Chris Suter
On 24/04/2008, at 4:14 PM, Daniel DeCovnick wrote: Honestly, I don't care how the data is stored, as long as I've got some reliable place to store file-specific data such that it can be reliably tied to the file (cross-user/cross-computer concerns are primary, cross-platform concerns are

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Daniel DeCovnick
I read that. I'm not sure I completely know what the resource map is. The resource manager keeps track of a table of resource types, and subtables of resource names or ID's as the key in a key-value pair, where the resources themselves are the values. Is that what the map is, that whole

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Uli Kusterer
Am 24.04.2008 um 09:16 schrieb Daniel DeCovnick: I read that. I'm not sure I completely know what the resource map is. The resource manager keeps track of a table of resource types, and subtables of resource names or ID's as the key in a key-value pair, where the resources themselves are

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Uli Kusterer
Am 24.04.2008 um 06:28 schrieb Graham Cox: On 24 Apr 2008, at 12:59 pm, Chris Suter wrote: The limits for resource forks are the same as for data forks Not true - the ResourceMap contains some 24-bit pointers, or at least it used to, as well as some 16-bit length fields as well. Unless

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Daniel DeCovnick
The tips are appreciated. AFAICT, the limit on total resource sizes is within a kB or 2 of 2 or 4 GB, with the limitation that the last resource must start within the first ~16 MB. Given the fact that the files I'm opening are in the 1-300k range, I suspect I have bigger problems than the

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Michael Ash
On Thu, Apr 24, 2008 at 12:46 AM, Chris Suter [EMAIL PROTECTED] wrote: On 24/04/2008, at 2:28 PM, Graham Cox wrote: On 24 Apr 2008, at 12:59 pm, Chris Suter wrote: The limits for resource forks are the same as for data forks Not true - the ResourceMap contains some 24-bit

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread glenn andreas
On Apr 24, 2008, at 6:08 AM, Daniel DeCovnick wrote: The tips are appreciated. AFAICT, the limit on total resource sizes is within a kB or 2 of 2 or 4 GB, with the limitation that the last resource must start within the first ~16 MB. Given the fact that the files I'm opening are in the

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Hamish Allan
On Thu, Apr 24, 2008 at 4:28 PM, Daniel DeCovnick [EMAIL PROTECTED] wrote: Er... either my calculator's broken or (65535 - 30 - 8 )/12 = 5458, not 2727, where 30 and 8 are the resource map header and a single reference type. However, floor((32767 - 30 - 8) / 12) = 2727. Maybe the use of a

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-24 Thread Bill Monk
On Thu, Apr 24, 2008 at 4:28 PM, Hamish Allan wrote: Maybe the use of a signed int is the well-known bug Uli referred to. Indeed it is. Tech Note TB18 (1988) http://beta.devworld.apple.com/technotes/tb/tb_18.html ___ Cocoa-dev mailing list

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Jens Alfke
On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote: Through a lot of thought experiments, I've come to the conclusion that the best place to save this sort of thing would be in the resource fork of the file being opened, but I could be totally off the mark there, and it's certainly an

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
On Apr 23, 2008, at 2:07 AM, Jens Alfke wrote: On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote: Through a lot of thought experiments, I've come to the conclusion that the best place to save this sort of thing would be in the resource fork of the file being opened, but I could be

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Rob Keniger
On 23/04/2008, at 5:41 PM, Daniel DeCovnick wrote: Thanks for the suggestion. I've just looked through them now, as well as at the OSXBook (Mac OS X Internals: A Systems Approach by Amit Singh) info on that. In theory it looks good, but it's somewhat confusing. It looks like, at least in

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Ken Thomases
On 23/04/2008, at 5:41 PM, Daniel DeCovnick wrote: Thanks for the suggestion. I've just looked through them now, as well as at the OSXBook (Mac OS X Internals: A Systems Approach by Amit Singh) info on that. In theory it looks good, but it's somewhat confusing. It looks like, at least in

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Matt Gough
I'd second that. The OS (well, Finder) also adds things to the resource fork of files (custom icons, info about which app to open a file with when you changed it from the default etc). Just as long as you respect the existing contents this is exactly where you should put your data. On

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Adam R. Maxwell
On Apr 23, 2008, at 12:41 AM, Daniel DeCovnick wrote: On Apr 23, 2008, at 2:07 AM, Jens Alfke wrote: On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote: Through a lot of thought experiments, I've come to the conclusion that the best place to save this sort of thing would be in the

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Sean McBride
On 4/23/08 1:21 AM, Daniel DeCovnick said: I'm writing an application that opens particular kinds of files, parses them, displays an editable graphical representation of the contents of a file, and saves the results of the changes to the file. However, some graphical changes don't result in

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Jens Alfke
Another possibility is to write a short unique string (like a UUID) into an extended attribute, and then use that as a key into your own external data store, like a database or plist you put in some central place. A nice feature of this approach is that you only have to modify the file

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
That's pretty much option 1, albeit implemented slightly more robustly than I was thinking of. But my data's not sensitive, so there's no advantage in losing it on sending it to someone else, and in fact I'd much prefer it was retained if possible. -Dan On Apr 23, 2008, at 11:10 AM, Jens

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread John Stiles
Thirded. Matt Gough wrote: I'd second that. The OS (well, Finder) also adds things to the resource fork of files (custom icons, info about which app to open a file with when you changed it from the default etc). Just as long as you respect the existing contents this is exactly where you

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
That the Resource Manager is still around in 64-bit definitely alleviates one of my concerns - will whatever I use still be around in the future? Thanks much, Dan On Apr 23, 2008, at 10:12 AM, Sean McBride wrote: On 4/23/08 1:21 AM, Daniel DeCovnick said: I'm writing an application that

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Gerd Knops
Coincidentally I just went through that same song and dance. With Spotlight becoming more and more important in OSX, it is surprising Apple has not provided a clean method to store arbitrary metadata with any kind of file. Maybe time for us all to file an enhancement request. As others

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
Actually it is possible, at least according to the OSXBook, to add arbitrary key-value paired metadata to a file (IIRC, all MDItem keys share a flat namespace). It theoretically works without Spotlight, but nothing uses metadata that doesn't use Spotlight currently, AFAIK, and my data

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Uli Kusterer
Am 23.04.2008 um 09:41 schrieb Daniel DeCovnick: Thanks for the suggestion. I've just looked through them now, as well as at the OSXBook (Mac OS X Internals: A Systems Approach by Amit Singh) info on that. In theory it looks good, but it's somewhat confusing. It looks like, at least in

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Uli Kusterer
Am 23.04.2008 um 17:10 schrieb Jens Alfke: Another possibility is to write a short unique string (like a UUID) into an extended attribute, and then use that as a key into your own external data store, like a database or plist you put in some central place. Not a good idea. The user

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Chris Williams
But the resource fork idea has the same issue if someone uses/sends/writes to the file from the other 90% of the computers on the planet... (windows). Doesn't it? I think you're best tracking the info in your own data source, doing your best to track and keep up with the user changing it outside

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Mike Fischer
Am 23.04.2008 um 09:43 schrieb Daniel DeCovnick [EMAIL PROTECTED]: On Apr 23, 2008, at 2:07 AM, Jens Alfke wrote: On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote: Through a lot of thought experiments, I've come to the conclusion that the best place to save this sort of thing would be in

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
You may want to look at the size limits on resource forks, though. I thought I'd blogged about that ages ago, but can't find the posting right now. The resource fork format is documented, though, so it shouldn't be too hard to figure out. There's for example a 2727 resources limit on

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Chris Suter
On 24/04/2008, at 11:53 AM, Daniel DeCovnick wrote: I'm pretty sure the resource fork size limits are rather large... EV Nova's data files, in which everything is stored in the resource fork, go up to 13.8 MB. Also, it's a definite advantage that the resource fork is well-documented.

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Jason Stephenson
Chris Suter wrote: Furthermore, it doesn't follow the file which was the original design goal. Going back to the original question, I personally think that the best thing to do is to just create another file and educate the user. Extended attributes and resource forks are all very nice but

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
The problem with that is, as I wrote in my first message, the real data files aren't mine, and won't be opened by my app exclusively. The data that I need to save ought to be invisible to the file's owner. Imagine, for example, that when working on a file in HexEdit, it allowed you to

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Dmitry Markman
I'm not sure what is all about all resources can be stored in the data fork resource manager perfectly understands it there is no reason whatsoever to use resource fork. you can easiliy convert old resource file (with resources in the resource fork) to resource file with resources in the data

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Graham Cox
On 24 Apr 2008, at 12:59 pm, Chris Suter wrote: The limits for resource forks are the same as for data forks Not true - the ResourceMap contains some 24-bit pointers, or at least it used to, as well as some 16-bit length fields as well. Unless these have been changed (possible I guess, I

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Chris Suter
On 24/04/2008, at 2:28 PM, Graham Cox wrote: On 24 Apr 2008, at 12:59 pm, Chris Suter wrote: The limits for resource forks are the same as for data forks Not true - the ResourceMap contains some 24-bit pointers, or at least it used to, as well as some 16-bit length fields as well.

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Graham Cox
On 24 Apr 2008, at 2:46 pm, Chris Suter wrote: On 24/04/2008, at 2:28 PM, Graham Cox wrote: On 24 Apr 2008, at 12:59 pm, Chris Suter wrote: The limits for resource forks are the same as for data forks Not true - the ResourceMap contains some 24-bit pointers, or at least it used to, as