readonly status conflict with reading

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

readonly status conflict with reading

Stéphane Ducasse
Hi john

When I set on mac a file to readonly, I get nil when I do
FileStream named: 'foo.txt'


Stef

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: readonly status conflict with reading

Schwab,Wilhelm K
Stef,

FWIW, the biggest problem I see with this is returning nil rather than raising an exception.  With that omission corrected, there are various ways I could envision it working, probably centered on failing to open a writable stream, but if one asks for a read-only stream, there would be no need for an error.  I don't too much care what the rules are, so long as the system enforces them consistently and tells me when I violate them.

Attached is a partial view of what I have been doing as I find such things in my way.  The goals are to provide entry points that my existing code expects and to (a path, not a destination) never fail silently.

Bill


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
Sent: Saturday, October 09, 2010 2:39 AM
To: Pharo Development
Subject: [Pharo-project] readonly status conflict with reading

Hi john

When I set on mac a file to readonly, I get nil when I do
FileStream named: 'foo.txt'


Stef

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

FileStream class-*dolphincompatibility-streams.st (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: readonly status conflict with reading

Levente Uzonyi-2
In reply to this post by Stéphane Ducasse
On Sat, 9 Oct 2010, Stéphane Ducasse wrote:

> Hi john
>
> When I set on mac a file to readonly, I get nil when I do
> FileStream named: 'foo.txt'

I guess that's #fileNamed:, not #named:. When you send that method, you're
trying to open the file in read-write mode. If you just want to read from
a file then use #readOnlyFileNamed:.


Levente

>
>
> Stef
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: readonly status conflict with reading

Stéphane Ducasse
In reply to this post by Stéphane Ducasse

On Oct 9, 2010, at 3:48 PM, Levente Uzonyi wrote:

> On Sat, 9 Oct 2010, Stéphane Ducasse wrote:
>
>> Hi john
>>
>> When I set on mac a file to readonly, I get nil when I do
>> FileStream named: 'foo.txt'
>
> I guess that's #fileNamed:, not #named:. When you send that method, you're trying to open the file in read-write mode. If you just want to read from a file then use #readOnlyFileNamed:.

Yes stupid me.
I really do not like this file operation names.

Stef


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project