On 17 Nov 2018, at 16:04, Hans-Martin <pharo-dev@fam-mosner.de> wrote:
Hi, I've stumbled upon a 7.0 incompatibility with regards to how file names are treated. In 6.1, I can use Strings and FileLocators interchangeably to create and read Zip archives. That's because StandardFileStream does the magic behind the screnes.
Could you give a code example ? What API/methods are you talking about ? What worked before and does not work anymore ?
In 7.0, StandardFileStream has been deprecated, and "File openForReadFileNamed:" is used instead. That method does not handle FileLocators, so code that uses FileLocators to open Zip archives ceased to work.
*NO* you should not use File directly. Just use FileReference instances (however you create them) and work from there. If you got a string path, use #asFileReference. FileLocator desktop / 'foo.txt readStreamDo: [ :in | in upToEnd ] MyObject>>#readFromFile: file ^ file asFileReference readStreamDo: [ :in | self readFromStream: in ]
What's the preferred solution? It strikes me as illogical that objects which were made to reference files can't be used to reference files in these contexts. However, there may be a conscious design decision behind this change that's just not obvious to me.
Cheers, Hans-Martin
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html