Alternative directory/file classes?

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

Alternative directory/file classes?

Andreas.Raab
Hi -

Recently I got (once again ;-) horribly disgusted by the mess in the
current file/directory classes in Squeak and started looking for
alternatives. Besides Flow (which I knew about but which is a bit too
far-reaching for what I'm after) I was particularly impressed by looking
at FileMan which seemed a nice and simple interface to do all the
practical things that you need when dealing with files/directories. A
couple of questions related to it:
1) Is anyone using FileMan in production environments? How does it hold
up in practice?
2) I presume FileMan still requires FileDirectory and friends in all
their splendid uglyness. Has anyone looked at making FileMan the only
interface to access directories?
3) Are there any other directory/file interfaces I should be looking at
in my quest for a bit more cleanliness in these areas?

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Bert Freudenberg
On Mar 11, 2007, at 9:17 , Andreas Raab wrote:

> Hi -
>
> Recently I got (once again ;-) horribly disgusted by the mess in  
> the current file/directory classes in Squeak and started looking  
> for alternatives. Besides Flow (which I knew about but which is a  
> bit too far-reaching for what I'm after) I was particularly  
> impressed by looking at FileMan which seemed a nice and simple  
> interface to do all the practical things that you need when dealing  
> with files/directories. A couple of questions related to it:
> 1) Is anyone using FileMan in production environments? How does it  
> hold up in practice?
> 2) I presume FileMan still requires FileDirectory and friends in  
> all their splendid uglyness. Has anyone looked at making FileMan  
> the only interface to access directories?
> 3) Are there any other directory/file interfaces I should be  
> looking at in my quest for a bit more cleanliness in these areas?

FileMan and Rio have been discussed on the 3.10 release team list. I  
tried to pursue them to move the discussion to squeak-dev, without  
success, yet.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Stéphane Rollandin
In reply to this post by Andreas.Raab
Andreas Raab wrote:
> 3) Are there any other directory/file interfaces I should be looking at
> in my quest for a bit more cleanliness in these areas?

there is FileReference in muO.

I don't know if it is less ugly than FileDirectory and friends, I just
like it better...


Stef

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

keith1y
In reply to this post by Andreas.Raab
Dear Andreas,

with this in mind I have been working on Rio, inspired by a generally
useful io library for ruby. After not much work I am quite pleased with
the results for far.

simple stuff, building paths.

myFile := Rio default / 'hello' + '.txt'.   "or even Rio / 'hello' as an
abbreviation"

testing & stat stuff:
self assert: (myFile exists).
self assert: (myFile isFile).
self assert: (myFile parent isDirectory).
mt := myFile modificationTime.
ct := myFile creationTime.
size := myFile size.

accessing path bits.
self assert: (myFile basename = 'hello')
self assert: (myFile ext = 'txt')
self assert: (myFile filename = 'hello.txt')

changing rio filename:
myFile ext: 'text'.
myFile basename: 'goodbye'.
myFile filename: 'goodbye.dat'.

renaming files in filesystem:
myFile rename ext: 'text'.
myFile rename basename: 'goodbye'.
myFile rename filename: 'goodbye.dat'.
myFile renameTo: 'world.txt'.

reading writing etc.

myFile write in: [ :str |  ].
myFile < 'contents'.
allContents := myDirectoryRio files collect: [ :f | f read contents ].

more iterating:
Rio default all select: [ :stat | (stat filename endsWith: '.st') &
fStat modificationTime > '1-1-07' asDate) ]

I did a brief comparison with FileMan
http://wiki.squeak.org/squeak/5929

rio is available from http://www.squeaksource.com/Rio

Rio is different to Fileman in that it does not use FileDirectory at
all, instead it re-implements all of the same functionality and much of
FileMan's. Doing so has enabled great economies. Fileman + FileDirectory
is about 110k of source. RioKernel is 8k with Rio-Core being another 20k.

Rio is experimental, most of it works, there are extensive ramblings of
ideas in the class comments. Encoding is not yet supported, because I
don't fully understand how it is used yet. The plan is to break Rio down
into modules, specifically into a bare minimum "RioKernel" for those
interested in producing KernelImages. At present I am defining
RioKernelTests collecting the use cases for defining this Kernel. Once
RioKernel is defined I hope to be able to make FileDirectory unloadable. :-)

thats as far as it goes so far... more to come

Keith


>
> Recently I got (once again ;-) horribly disgusted by the mess in the
> current file/directory classes in Squeak and started looking for
> alternatives. Besides Flow (which I knew about but which is a bit too
> far-reaching for what I'm after) I was particularly impressed by
> looking at FileMan which seemed a nice and simple interface to do all
> the practical things that you need when dealing with
> files/directories. A couple of questions related to it:
> 1) Is anyone using FileMan in production environments? How does it
> hold up in practice?
> 2) I presume FileMan still requires FileDirectory and friends in all
> their splendid uglyness. Has anyone looked at making FileMan the only
> interface to access directories?
> 3) Are there any other directory/file interfaces I should be looking
> at in my quest for a bit more cleanliness in these areas?
>
> Cheers,
>   - Andreas
>
>


               
___________________________________________________________
Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Andreas.Raab
Hi Keith -

 > rio is available from http://www.squeaksource.com/Rio

I was trying to load rio (what does "rio" it stand for btw?) but
unsucessfully. I get error messages about the absence of the classes
Rio, TRioMacOS, TRioRiscOS, TRioWin32, and TRioUnix and indeed, if you
go to squeaksource and browse the code of, say Rio-kph.16.mcz it shows
these classes in the extensions. But something must be wrong there, too,
since although it lists these classes it does not show the "proper"
extension categories. Not sure what went wrong here, perhaps a broken
upload?

In any case, help is greatly appreciated.

Cheers,
   - Andreas

Keith Hodges wrote:

> Dear Andreas,
>
> with this in mind I have been working on Rio, inspired by a generally
> useful io library for ruby. After not much work I am quite pleased with
> the results for far.
>
> simple stuff, building paths.
>
> myFile := Rio default / 'hello' + '.txt'.   "or even Rio / 'hello' as an
> abbreviation"
>
> testing & stat stuff:
> self assert: (myFile exists).
> self assert: (myFile isFile).
> self assert: (myFile parent isDirectory).
> mt := myFile modificationTime.
> ct := myFile creationTime.
> size := myFile size.
>
> accessing path bits.
> self assert: (myFile basename = 'hello')
> self assert: (myFile ext = 'txt')
> self assert: (myFile filename = 'hello.txt')
>
> changing rio filename:
> myFile ext: 'text'.
> myFile basename: 'goodbye'.
> myFile filename: 'goodbye.dat'.
>
> renaming files in filesystem:
> myFile rename ext: 'text'.
> myFile rename basename: 'goodbye'.
> myFile rename filename: 'goodbye.dat'.
> myFile renameTo: 'world.txt'.
>
> reading writing etc.
>
> myFile write in: [ :str |  ].
> myFile < 'contents'.
> allContents := myDirectoryRio files collect: [ :f | f read contents ].
>
> more iterating:
> Rio default all select: [ :stat | (stat filename endsWith: '.st') &
> fStat modificationTime > '1-1-07' asDate) ]
>
> I did a brief comparison with FileMan
> http://wiki.squeak.org/squeak/5929
>
> rio is available from http://www.squeaksource.com/Rio
>
> Rio is different to Fileman in that it does not use FileDirectory at
> all, instead it re-implements all of the same functionality and much of
> FileMan's. Doing so has enabled great economies. Fileman + FileDirectory
> is about 110k of source. RioKernel is 8k with Rio-Core being another 20k.
>
> Rio is experimental, most of it works, there are extensive ramblings of
> ideas in the class comments. Encoding is not yet supported, because I
> don't fully understand how it is used yet. The plan is to break Rio down
> into modules, specifically into a bare minimum "RioKernel" for those
> interested in producing KernelImages. At present I am defining
> RioKernelTests collecting the use cases for defining this Kernel. Once
> RioKernel is defined I hope to be able to make FileDirectory unloadable.
> :-)
>
> thats as far as it goes so far... more to come
>
> Keith
>
>
>>
>> Recently I got (once again ;-) horribly disgusted by the mess in the
>> current file/directory classes in Squeak and started looking for
>> alternatives. Besides Flow (which I knew about but which is a bit too
>> far-reaching for what I'm after) I was particularly impressed by
>> looking at FileMan which seemed a nice and simple interface to do all
>> the practical things that you need when dealing with
>> files/directories. A couple of questions related to it:
>> 1) Is anyone using FileMan in production environments? How does it
>> hold up in practice?
>> 2) I presume FileMan still requires FileDirectory and friends in all
>> their splendid uglyness. Has anyone looked at making FileMan the only
>> interface to access directories?
>> 3) Are there any other directory/file interfaces I should be looking
>> at in my quest for a bit more cleanliness in these areas?
>>
>> Cheers,
>>   - Andreas
>>
>>
>
>
>        
> ___________________________________________________________ Now you can
> scan emails quickly with a reading pane. Get the new Yahoo! Mail.
> http://uk.docs.yahoo.com/nowyoucan.html
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

keith1y
Andreas Raab wrote:
> Hi Keith -
>
> > rio is available from http://www.squeaksource.com/Rio
I deleted the older "Rio" packages to avoid confusion.
Load order is

Rio-Kernel
Rio-Core
Rio-Tests

Keith


       
       
               
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

keith1y
I assume the name Rio stands for ruby-io. see, http://rio.rubyforge.org

Although I understand that this name may not be the most appropriate for
Squeak, I have yet to think of anything better. Predictably in ruby Rio
classes the is a class called Rio::Grande

Rio is quite a nice name in itself, I quite like it. I am open to
alternative suggestions, anyone?

Keith

               
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

keith1y
In reply to this post by keith1y
I also discovered that there is also a dependency upon the message
eating Null package available at:

http://www.squeaksource.com/Null

Keith Hodges wrote:

> Andreas Raab wrote:
>> Hi Keith -
>>
>> > rio is available from http://www.squeaksource.com/Rio
> I deleted the older "Rio" packages to avoid confusion.
> Load order is
>
> Rio-Kernel
> Rio-Core
> Rio-Tests
>
> Keith


       
       
               
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Masashi UMEZAWA-2
In reply to this post by Andreas.Raab
Hi,

> 1) Is anyone using FileMan in production environments? How does it hold
> up in practice?

I originally developed FileMan for daily uses. Now I uses it in my
both personal and commercial projects. It is very stable since it just
wraps existing libraries.

> 2) I presume FileMan still requires FileDirectory and friends in all
> their splendid uglyness. Has anyone looked at making FileMan the only
> interface to access directories?

FileMan was a very small scoped project. I just wanted to hide
uglyness of FileDirectory. In that point, it fulfills the role. But
since FileMan seems to get some popularity these days, I think it
needs more drastic overhaul (toward FileMan2).

> 3) Are there any other directory/file interfaces I should be looking at
> in my quest for a bit more cleanliness in these areas?

Rio seems to be very promising. Probably we can put our efforts together.

Cheers,
--
[:masashi | ^umezawa]

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Masashi UMEZAWA-2
In reply to this post by keith1y
Hi, Keith

I just started to play around Rio and found that there is a trivial
bug in Rio>>printOn: (or I missed something?).

Anyway, this is a patch.

And, I also noticed that "Rio default" points different locations
according to the running platforms. (In Windows, it returns drive
root, while in Linux, it returns Squeak current directory).

I would like to say thanks for your great efforts. Maybe I should have
noticed your work earlier.

Cheers,
--
[:masashi | ^umezawa]



Rio-printOn-patch.1.cs (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

keith1y
Masashi UMEZAWA wrote:
>
> I would like to say thanks for your great efforts. Maybe I should have
> noticed your work earlier.
>
> Cheers,

Hi Masashi,

I have only been working on Rio for two days, so I think you can be
forgiven ;-)
do note that I have really been hacking about with it recently, so if it
doesnt work wait 30 mins and you never know I might have fixed it.

If you find something to fix or would like to help out with the other
platforms I can usually hanging around in irc, #squeak, and we could
collaborate.

best regards

Keith


       
       
               
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

keith1y
In reply to this post by Masashi UMEZAWA-2
Masashi UMEZAWA wrote:
> Hi, Keith
>
> I just started to play around Rio and found that there is a trivial
> bug in Rio>>printOn: (or I missed something?).
>
You did indeed miss something too controversial to be mentioned here. :-)

Its fixed in the latest

Keith

               
___________________________________________________________
All New Yahoo! Mail – Tired of Vi@gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Edgar J. De Cleene
In reply to this post by Masashi UMEZAWA-2



El 3/11/07 11:38 PM, "Masashi UMEZAWA" <[hidden email]> escribió:

> Rio seems to be very promising. Probably we can put our efforts together.
>
> Cheers,
> --
> [:masashi | ^umezawa]

Masashi:

I using FileMan some time , so I know is very nice.
As Keith is in the "Discussion about development of Squeak 3.10"
<[hidden email]> list and we also email private, he
start to advocate for Rio.
As part of the 3.10 Release Team , I ask to he if possible use both.
But seems better you and Keith work together.
I ask you if you have time to join to list ?
Maybe "FileManInRio" could go into the image.

Edgar



       

       
               
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas


Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Michael Davies-2
In reply to this post by keith1y
> Rio is quite a nice name in itself, I quite like it. I am open to
> alternative suggestions, anyone?

Keep the name, just change the expansion - "Refactored" rather than "Ruby"!

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Bert Freudenberg
On Mar 12, 2007, at 11:56 , Michael Davies wrote:

>> Rio is quite a nice name in itself, I quite like it. I am open to
>> alternative suggestions, anyone?
>
> Keep the name, just change the expansion - "Refactored" rather than  
> "Ruby"!

Well, I wouldn't call it a refactoring - it's not meant to replace  
the "real" directory classes, is it? At least in Ruby it's just a  
convenience wrapper.

Now, I certainly wish for more sensible directory handling, and if I  
had my say it would be based on URIs.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Masashi UMEZAWA-2
In reply to this post by Edgar J. De Cleene
Hi, Edgar,

Thanks for introducing 3dot10 list. I've just subscribed.

For the stability, I think legacy FileMan still has a place in 3.10.
More drastic, future thing (whatever the name) should be well tested,
because file operation is so critical. If the interfaces are similar,
migration would be easy.

Cheers,

> Masashi:
>
> I using FileMan some time , so I know is very nice.
> As Keith is in the "Discussion about development of Squeak 3.10"
> <[hidden email]> list and we also email private, he
> start to advocate for Rio.
> As part of the 3.10 Release Team , I ask to he if possible use both.
> But seems better you and Keith work together.
> I ask you if you have time to join to list ?
> Maybe "FileManInRio" could go into the image.
>
> Edgar
>

--
[:masashi | ^umezawa]

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Edgar J. De Cleene



El 3/12/07 8:48 AM, "Masashi UMEZAWA" <[hidden email]> escribió:

> For the stability, I think legacy FileMan still has a place in 3.10.
I should send mail earlier to you.
I like FileMan , was using in my own things, and I suggest using it.
Current 3.10 could load via Universes

> More drastic, future thing (whatever the name) should be well tested,
> because file operation is so critical.

I kidding with name :=).
Off course nothing go into 3.10 without test, or without express agree of
some more people here or in general list saying what is good a thing having
XYZ package.

Hope Keith and you comes with a super package before we reach final.

Welcome and thanks .

Edgar



       

       
               
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas


Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

keith1y
In reply to this post by Bert Freudenberg
Bert Freudenberg wrote:
>
> Well, I wouldn't call it a refactoring - it's not meant to replace the
> "real" directory classes, is it?
Dear Bert,

it most definitely IS meant to replace the "real" directory classes. A
quote from the class comment:

    "A Rio is an experimental version of ruby's rio in smalltalk, so as
to compare with other     approaches such as Fileman, the intention
being to murder FileDirectory!"

If you layer a wrapper on top of FileDirectory you are building on a
base with lots of methods. If you begin from scratch, it turns out that
most of the interesting functionality is layered on top of one method.
(currently called #on:recusively:select:)

Rio, builds upon RioKernel (7.5k of source), rather than FileDirectory
(85k of source).

Unfortunately I do not have access to a windows machine at the moment so
I may need some help to make this fly.

Keith


       
       
               
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Bert Freudenberg

On Mar 12, 2007, at 14:12 , Keith Hodges wrote:

> Bert Freudenberg wrote:
>>
>> Well, I wouldn't call it a refactoring - it's not meant to replace  
>> the "real" directory classes, is it?
> Dear Bert,
>
> it most definitely IS meant to replace the "real" directory  
> classes. A quote from the class comment:
>
>    "A Rio is an experimental version of ruby's rio in smalltalk, so  
> as to compare with other     approaches such as Fileman, the  
> intention being to murder FileDirectory!"

Cool. Rio in Ruby appears to be just a convenience library, so excuse  
my misunderstanding.

> building on a base with lots of methods. If you begin from scratch,  
> it turns out that most of the interesting functionality is layered  
> on top of one method. (currently called #on:recusively:select:)

Well, FileDirectory perhaps does too much, hence a lot of code. The  
"interesting" functionally would have to be defined. One non-obvious  
functionality is that it is polymorphic with ServerDirectory. That's  
the foundation why tools like FileList work on files as well as  
remote locations transparently. I'd expect the same from a replacement.

In any case, if this is not just a convenience wrapper, I'd certainly  
give it an intention-revealing name in best Smalltalk tradition  
rather than an arbitrary fantasy name.

> Unfortunately I do not have access to a windows machine at the  
> moment so I may need some help to make this fly.

Cross-platform file support has been a real pain in the past, mostly  
because users usually only develop on one platform and unconsciously  
use platform-dependent strings for filenames. I've been working with  
the URI package lately (http://www.squeaksource.com/URI.html) which  
is a real pleasure because it just does the Right Thing when taking  
your code from one platform to the next.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: Alternative directory/file classes?

Michael Davies-2
In reply to this post by keith1y
> > > rio is available from http://www.squeaksource.com/Rio
> I deleted the older "Rio" packages to avoid confusion.
> Load order is
>
> Rio-Kernel
> Rio-Core
> Rio-Tests
>

Hi Keith, I'm still seeing the problem that Andreas reported -
Rio-Kernel-kph.13.mcz is attempting to define methods on classes that
it hasn't defined, including RioKernel and the TRioXXXXX classes.

Cheers, Michael

12