Hello,
I have run into what seems to be a bug in FileStream/StandardFileStream.
I attempt to open a file.
f := StandardFileStream oldFileNamed: 'pathToFile'.
If file is open elsewhere for editing, f = nil.
If the file is not open elsewhere, then the file opens properly.
If I attempt to open read only.
f := StandardFileStream readOnlyFileNamed: 'pathToFile'.
Opens the file properly.
It seems to me that returning nil is an ugly response. I had no
knowledge why the file was not opening. At the time did not know I had
it open in another application.
Failing silently is not nice. I would have preferred an Error message or
something telling me that the file was open elsewhere and even possibly
letting me open as readOnly.
When we attempt to open a file with a filename that does not exist, we
get the nice option of either selecting (or correcting) a file name
which exists or creating a new file with the specified name.
With a small amount of naive browsing, I was not able to find where the
understanding of the file being locked elsewhere is found. So I only
offer my experience.
Thanks.
Jimmie