Equivalent to class FileDirectory and ReferenceStream in Pharo?

I am doing an example of stamina:

http://book.seaside.st/book/advanced/persistency/image-based-persistency

It involves creating a method that uses the FileDirectory class as follows:

SMFileDatabase class>>backupDirectory ^ (FileDirectory default directoryNamed: self name) assureExistence. 

Pharo does not seem to be able to find the class, and the closest that appears in the search is FileDirectoryWrapper. Will it do it?

NB. I can't figure it out myself since I never used FileDirectory or FileDirectoryWrapper before I will be in the dark.

Edit later:

Found another ReferenceStream. Both of them seem to be out of date. Mentioned here: http://lists.gforge.inria.fr/pipermail/pharo-project/2012-June/065765.html

Because they clearly had the problems mentioned here: Does Smalltalk ReferenceStream have problems with new instance variables?

Next, edit 2:

It seems that the answers below will work for FileDirectory, and the ReferenceStream can be replaced with Fuel in newer versions of Pharo. stack overflow

SmartRefStrem is another error solution. All of this has not been verified by me. Are Smalltalk ReferenceStream having problems with new instance variables?

But:

Those who want to finish the example in the book should go back in time and get Pharo 1.4: https://gforge.inria.fr/frs/?group_id=1299

Scroll down and find One-Click Pharo 1.4 and get the latest build if there is a newer one than: https://gforge.inria.fr/frs/download.php/file/31359/Pharo-1.4-14457-OneClick.zip

or 1.3 .

I got lucky with Pharo VM from here: http://files.pharo.org/vm/pharo/20/mac/stable.zip

With a pre-created seaside image running on Pharo 1.3 here: http://www.seaside.st/distributions/Seaside-3.0.7-final.zip

Extract your code from the current image via Monticello, and then return to the previous image. Success!

+2
source share
2 answers

The easiest way to do this:

 self name asFileReference ensureCreateDirectory. 
+4
source

Faro switched to FileSystem some time after the publication of the book.

Equivalent to the first code now

 SMFileDatabase class>>backupDirectory ^(FileSystem disk workingDirectory / self name) ensureCreateDirectory 

(also, regarding the ReferenceStream , Damien's response in the message you specified is still saved)

+2
source

All Articles