File system access in Squeak

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

File system access in Squeak

Navodit Kaushik
Hi
 
Can anyone suggest a good package for file system access? Someone suggested Rio but I am not sure how to install it as it does not show up in the Package loader...
 
I want to be able to work with the files on a ftp server and am not sure what to use for this. If possible an example script to connect to a ftp server and work with the files therein would be really helpful. Thanks
 
Navodit
 
 


Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: File system access in Squeak

Michael van der Gulik-3
Navodit Kaushik wrote:

> Hi
>  
> Can anyone suggest a good package for file system access? Someone
> suggested Rio but I am not sure how to install it as it does not show
> up in the Package loader...
>  
> I want to be able to work with the files on a ftp server and am not
> sure what to use for this. If possible an example script to connect to
> a ftp server and work with the files therein would be really helpful.
> Thanks
>  

Hi Navodit.

Sorry that nobody seems to have much advice for what you're trying to
do! What are you trying to do (at a higher level)? Is this commercially
important or one of your own projects? What are the files that you're
trying to move around - perhaps there's a better way of doing it?

Anyway... here's some example code for opening an ftp connection to a
remote server. This only uses classes from the basic Squeak release (in
this case, 3.10):

s := ServerDirectory new.
s fullPath: 'ftp://[hidden email]/www'.
s password: 'wachtwoord'.
s openFTPClient.
s directoryNames inspect.
s quit.

To work out how to do this (I've never done it before), I:

1. Opened up a Browser, right-clicked on the categories pane and chose
"find class...", searching for "ftp".

2. Found the "FTPClient class", read the class comment which says to
look in ServerDirectory for examples.

3. Went to the ServerDirectory class, looked at the available methods. I
opened up a workspace and tried a few things.

4. I got an UndefinedObject>>errorNotIndexable error when I tried the
first time to open a connection. I looked at the code in the debugger
and realised that the "newDirName" variable in FTPClient was not set,
probably meaning I also need to set a directory before opening the
connection.

5. I went back to the ServerDirectory Browser, clicked on the "inst
vars" button and realised that there was a "directory" instance
variable. Clicking on that, I saw that it was accessed by "fullPath:".
Reading the comment in that method, I completed my code snippit.

Try running through the same process of discovery, and especially look
at the methods available in the ServerDirectory class. One of the
reasons that Squeak doesn't have much specific documentation is because
once you're familiar with the tools, you find it really doesn't need much!

Michael.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: File system access in Squeak

Göran Krampe
In reply to this post by Navodit Kaushik
Hi!

> Hi
>
>   Can anyone suggest a good package for file system access? Someone
> suggested Rio but I am not sure how to install it as it does not show up
> in the Package loader...

AFAIK Rio is still being developed by Keith, probably not "ready" yet.

>   I want to be able to work with the files on a ftp server and am not sure
> what to use for this. If possible an example script to connect to a ftp
> server and work with the files therein would be really helpful. Thanks

In fact, ServerDirectory/FileDirectory and friends can work with ftp
servers out-of-the-box in Squeak. I don't have pointers or snippets right
now but if you still fail to find anything, cc me privately and I can dig
something out.

I would guess you can easily find example code in Monticello - since it
can use ftp repos for snapshots.

>   Navodit

regards, Göran

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners