On Jul 31, 2008, at 10:25 am, jda wrote:
ResourceFork is deprecated and scheduled for oblivion, so I'm
looking for another solution to handle the following situation (on a
Mac, of course)
I have a series of ancillary text files whose names my app displays
to the user in a listbox. These files contain connection information
that my app uses to access different Internet sites. There is one
function (it doesn't matter what) that can be enabled or disabled,
and I want the user to see that in the listbox display.
My solution has been to add a resource of my own making to each file
that contains text, either "true" or "false". If "true", the name of
the file is displayed in italics in the listbox. If "false" it is
displayed in plain text. So all I need do is check the resource of
each file (there may be many hundreds of them) and then set the text
style of the listbox cell accordingly.
Without the resource fork, I can see only two solutions when I
iterate over each of these files. One is to open each file, read in
the data, determine if the function is enabled or not, close the
file, and then set the listbox. This is clearly a poor solution with
many hundreds of files to examine. The second solution I can think
of is to assign a different extension to the files (e.g. .en for
function enabled, .dis for function disabled, or some such thing),
that my app can examine as it iterates over the file names to
determine if the function is enabled or not. This also strikes me as
kludgey and prone to cause problems.
Basically I would like a way to determine a simple boolean setting
of a file without having to open it and parse its contents. The
ResourceFork was perfect for this. I'd appreciate any thoughts on
the replacements I've come up with, or any I haven't considered.
Since you obviously want the data stored with the file, I see two
possibilities:
1. Add a boolean to the beginning (or end) of each file using a
binaryStream and read only that bit and then close the file. I
wouldn't think this would be too taxing to do.
2. Save your files as "Packages" the way Keynote or Pages does so that
a "File" can store more than just one file's worth of info.
Greg
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|