On 28-Jan-06, at 4:18 AM, CV wrote:
Remember that just because you get a non-Nil FolderItem that can
represent a file, that does not ensure that such a file actually
exists! So, before you try to open and read from the file, check
that it exists.
That is very true but a non-nil folderitem can pass the existence
test and still raise a nil object on textinputstream.
Charles Yeomans has an interesting discussion and code on reading a
text file here:
http://www.declaresub.com/Articles/ReadTextFile.html
Very true. But, the reasons Charles mentions are not often common
with Preferences folder files when used correctly. This is not to say
they can never happen however, with proper coding, they won't
normally occur.
1. the file has been moved, renamed or deleted by another process:
This is usually handled by creating a new default preferences file by
the application if it doesn't find the correct one.
2. the user lacks read permissions:
The user *always* has complete read/write access to the User's
Preferences folder. Which is why it is often the easiest place to put
preferences.
3. the file is already open:
Not really a problem unless one has read and write streams in the
same method and neglects to close one before the other. Although
REALbasic will close it for you automatically once the method goes
out of scope, it is still best to close it yourself for that very
reason.
Brian's problems exist for other reasons but it is hard to help him
when he starts three different threads on the same matter, has three
different sets of errors and won't answer simple questions.
Hard to help him when he won't respond in a logical manner.
Terry
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>