[squeak-dev] opening a write-only file

Eliot Miranda eliot.miranda at gmail.com
Sat May 31 21:23:03 UTC 2014


Hi Doug,


On Sat, May 31, 2014 at 10:00 AM, Douglas McPherson <djm1329 at san.rr.com>
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.
>

Squeak has forceNewFileNamed: & forceNewFileNamed:do:.  If you look at
sqFileOpen in platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c
you'll see it first attempts to open read-write and if that fails, opens
write-only.  So it should work.

HTH

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?
>
> Thanks,
> Doug
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140531/4346b228/attachment.htm


More information about the Squeak-dev mailing list