[squeak-dev] opening a write-only file

Douglas McPherson djm1329 at san.rr.com
Sat May 31 17:56:53 UTC 2014


Yes, but the file is write-only, not read-only :)

Interestingly, trying FileStream readOnlyFileNamed: 'foo' yields a FileDoesNotExistException, although the file does exist, it just happens to be write-only.

StandardFileStream fileNamed: 'foo' does not raise FileDoesNotExistException, instead fails to open the file and returns nil. 

Doug


On May 31, 2014, at 10:46 , David T. Lewis wrote:

> On Sat, May 31, 2014 at 10:00:06AM -0700, Douglas McPherson wrote:
>> Is there a way to open a write-only file in Squeak? On both Mac and Linux attempting to open such a file fails.
>> 
>> For example, if you create a write-only file, i.e. in a shell, after cd to default directory
>> 
>> echo nada > foo
>> chmod 200 foo
>> 
>> Then from Squeak
>> 
>> StandardFileStream fileNamed: 'foo'
>> 
>> returns nil.
>> 
>> If the file is given read permission (i.e. chmod 600 foo) then Squeak can open it.
>> 
>> Anyone know a workaround?
>> 
> 
> Sure, you can use FileStream readOnlyFileNamed: 'foo'.
> 
> Dave
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140531/54d29fbf/attachment.htm


More information about the Squeak-dev mailing list