Fwd: [Newbies] pathnames

Serge Stinckwich Serge.Stinckwich at info.unicaen.fr
Tue May 2 12:29:35 UTC 2006



Début du message réexpédié :

> De : Serge Stinckwich <Serge.Stinckwich at info.unicaen.fr>
> Date : 2 mai 2006 14:29:06 HAEC
> À : Ron at USMedRec.com
> Objet : Rép : [Newbies] pathnames
>
>
> Le 2 mai 06 à 14:19, Ron Teitelbaum a écrit :
>
>> Hi Chris,
>>
>> Welcome to the Beginners list.  Like you I've had some difficulty  
>> with the
>> file handling of Squeak.  From the format of your question it  
>> appears that
>> you are on something other then Windows but the methodology should be
>> similar.
>>
>> There are two pieces to getting at files first the directory piece.
>>
>> You can access directories and enumerate entries in directories by  
>> using:
>>
>> FileDirectory
>> FileDirectory default  <- will get you the directory that squeak  
>> is running
>> in
>> FileDirectory on: '/home/cpulo/data' <- will get you the directory
>> specified.
>>
>>> From this point if you need to access files you will need to use  
>>> FileStream.
>>
>>
>> For Windows we use:
>> 	 CrLfFileStream fileNamed: aFullPathName
>>
>> Look at the hierarchy for the stream you need.
>>
>> To put it all together you could get the contents of readme.txt by  
>> doing the
>> following.
>>
>> "return the contents of a file 'readme.txt' in the current directory"
>> aDirectory := FileDirectory default.
>> aStream := CrLfFileStream fileNamed: (aDirectory fullNameFor:  
>> 'readme.txt').
>> ^aStream contents.
>>
>
> To complete the reply :
>
> FileDirectory on:'/home/cpulo/data' fileNames => returns a list of  
> the name files inside your directory.
>
>
> --                                                         oooo
> Dr. Serge Stinckwich                                     OOOOOOOO
> Université de Caen>CNRS UMR 6072>GREYC>MAD               OOESUGOO
> http://purl.org/net/SergeStinckwich                       oooooo
> Smalltalkers do: [:it | All with: Class, (And love: it)]   \  /
>                                                             ##
>
>
>


--                                                         oooo
Dr. Serge Stinckwich                                     OOOOOOOO
Université de Caen>CNRS UMR 6072>GREYC>MAD               OOESUGOO
http://purl.org/net/SergeStinckwich                       oooooo
Smalltalkers do: [:it | All with: Class, (And love: it)]   \  /
                                                             ##





More information about the Beginners mailing list