9

Pharo 2.0更改了一些基本的 API 位,我找不到执行以下操作的新方法:

  1. FileDirectory default directoryNamed: aFolderString.
  2. FileDirectory on: aFilename.
  3. FileDirectory default assureExistenceOfPath: aString.
  4. ReferenceStream on: stream.

新的等效代码是什么?是否有描述如何翻译或移植代码的更新指南?

4

3 回答 3

13

以下陈述与您提出的问题相对应。

  1. FileSystem workingDirectory / aFolderString
  2. aFilename asFileReference
  3. aString asFileReference ensureDirectory
  4. ReferenceStream 在 2.0 中不再存在。

aPathString asFileReference解析aPathString,所以如果你的名字中有斜杠,你最终会进入一个子目录。

/另一方面,将单个目录或文件名作为参数,并且不解析进一步的子目录。根据您的平台,您可以轻松地引用名称foo/bar中带有斜杠的文件FileSystem workingDirectory / 'foo/bar'

于 2013-04-02T07:13:19.330 回答
9

我收集了一些您可能会觉得有用的翻译:

+------------------------------------------------------+---------------------------------------------------------------------------+
|                    FileDirectory                     |                                FileSystem                                 |
+------------------------------------------------------+---------------------------------------------------------------------------+
| FileDirectory assureExistence.                       | aString asFileReference ensureDirectory.                                  |
| FileDirectory baseNameFor: aString.                  | aString asFileReference base.                                             |
| FileDirectory containingDirectory.                   | Path parent asFileReference pathString.                                   |
| FileDirectory default deleteFileNamed: aString.      | aString asFileReference ensureDeleted.                                    |
| FileDirectory default directoryExists: aString.      | aString asFileReference exists.                                           |
| FileDirectory default directoryNamed: aFolderString. | FileSystem disk / aFolderString.                                          |
| FileDirectory directoryEntryFor: aString.            | aString asFilereference.                                                  |
| (FileDirectory entryFor: aString) / 'filename'.      | aString asFileReference / 'filename'.                                     |
| FileDirectory extensionFor: aString.                 | aString asFileReference extension.                                        |
| FileDirectory default fileExists: aString.           | aString asFileReference exists. " or " DiskStore current isFile: aString. |
| FileDirectory default fullNameFor: aString.          | aString asFileReference fullName.                                                         |
| FileDirectory default pathName.                      | FileSystem disk workingDirectory fullName.                                |
| FileDirectory on: aFilename.                         | aFilename asFileReference.                                                |
| (FileDirectory on: aString) entries collect: #name.  | aString asFileReference children collect: #basename.                      |
| (FileDirectory on: aString) entryAt: 'filename'.     | aString asFileReference / 'filename'.                                     |
| FileDirectory oldFileNamed: aString.                 | aString asFileReference readStream.                                       |
| FileDirectory slash.                                 | FileSystem disk separator. " or " DiskStore delimiter asString.           |
+------------------------------------------------------+---------------------------------------------------------------------------+
于 2013-04-23T00:28:15.007 回答
5

ReferenceStream 不再受支持,在 Pharo 2.0 中已被删除。您应该使用编写良好、文档完善、测试良好且速度非常快的 Fuel。http://rmod.lille.inria.fr/web/pier/software/Fuel

于 2013-04-02T08:57:45.403 回答