问题描述
我正在执行持久性示例:
I'm doing the persistance example at:
http://book.seaside.st/book/advanced/persistency/image-based-persistency
它涉及创建一个使用FileDirectory类的方法,如下所示:
It involves creating a method that uses the FileDirectory class like this:
SMFileDatabase class>>backupDirectory
^ (FileDirectory default directoryNamed: self name) assureExistence.
Pharo似乎无法找到Class,并且搜索中出现的最接近的是FileDirectoryWrapper.这样可以吗?
Pharo seems to be unable to find the Class and the closest that comes out in search is FileDirectoryWrapper. Will this do?
NB.我自己无法弄清楚这一点,因为我以前从未使用过FileDirectory或FileDirectoryWrapper,所以我处于黑暗中.
NB. I can't figure this out myself since I've never used FileDirectory or FileDirectoryWrapper before so I'm in the dark.
以后的修改:
找到了另一个ReferenceStream.他们似乎都已被弃用.在这里提到: http://lists.gforge.inria.fr/pipermail/pharo-project/2012-June/065765.html
Found another one ReferenceStream. They both seem to have been deprecated.Mentioned here:http://lists.gforge.inria.fr/pipermail/pharo-project/2012-June/065765.html
因为它们显然有问题,所以在这里提到: Smalltalk ReferenceStream在新的实例变量上有问题吗?
Because they apparently had problems, mentioned here:Smalltalk ReferenceStream has problems with new instance variables?
稍后
以下答案似乎适用于FileDirectory,在较新的Pharo发行版中,ReferenceStream可以由Fuel代替. https://stackoverflow.com/a/15742159/293856
It seems the answers below will work for FileDirectory, and ReferenceStream can be replaced by Fuel in newer Pharo releases.https://stackoverflow.com/a/15742159/293856
SmartRefStrem似乎是该bug的另一种解决方案.这一切都未经我检验. Smalltalk ReferenceStream在新的实例变量上有问题吗?
SmartRefStrem seems another solution to the bugs. All this is untested by me.Smalltalk ReferenceStream has problems with new instance variables?
但是:
那些想完成本书中示例的人需要回到过去,并从以下位置获得Pharo 1.4: https://gforge.inria.fr/frs/?group_id=1299
Those wanting to finish the example in the book need to go back in time and get a Pharo 1.4 from:https://gforge.inria.fr/frs/?group_id=1299
向下滚动并查找One-Click Pharo 1.4 ,并获得最新的版本(如果有比以下版本更新的版本): https://gforge.inria. fr/frs/download.php/file/31359/Pharo-1.4-14457-OneClick.zip
Scroll down and look for 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
或 1.3 .
我很幸运从这里获得了Pharo VM: http://files.pharo.org/vm/pharo/20/mac/stable.zip
I got lucky with a Pharo VM from here:http://files.pharo.org/vm/pharo/20/mac/stable.zip
在Pharo 1.3上运行的预构建Seaside图像在这里: http://www.seaside.st/distributions/Seaside-3.0. 7-final.zip
With a prebuilt Seaside image running on Pharo 1.3 here:http://www.seaside.st/distributions/Seaside-3.0.7-final.zip
通过Monticello从当前图像中获取代码,然后返回"到较早的图像中.成功!
Get your code out of the current image via Monticello and then "back" into the older image. Success!
推荐答案
最简单的方法如下:
self name asFileReference ensureCreateDirectory.
这篇关于在Pharo中FileDirectory和ReferenceStream类是否等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!