Streams and FileDialog in Pharo 6 and 7
Posted by Torsten Bergmann on Sep 06, 2018; 7:37pm
URL: https://forum.world.st/Streams-and-FileDialog-in-Pharo-6-and-7-tp5084352.html
Hi,
A question to those who worked on the new streams for Pharo 7:
In PHARO 6 I used the following expression to open a file dialog and let the user choose
a binary file:
s := UITheme builder fileOpen: 'Choose a file' extensions: #('exe').
This returned
- either nil (when file dialog was canceled)
- a "MultiByteFileStream" instance when a file was selected
The MultiByteFileStream instance already had the name of the file (= full path) and I was
able to query it for further use:
s := UITheme builder fileOpen: 'Choose a file' extensions: #('exe').
s name inspect
(for instance to display which file is processed in a window by showing the full path)
Now in PHARO 7 same expression returns an instance of ZnCharacterReadStream (as MultiByteFileStream
is deprecated):
s := UITheme builder fileOpen: 'Choose a file' extensions: #('exe').
and ZnCharacterReadStream does not understand #name - and in fact the info about the name is
totally lost/not available. To me this looks missing/broken.
So what is the recommended way in Pharo 7 to open a file dialog, let the use choose a file
and get a file stream but also the name? IMHO this is either broken or missing...
Thanks
T.