On 07.02.2014, at 06:38, Tudor Girba <tudor@tudorgirba.com> wrote:
One more question: How do I read the contents of a file from within a zip?
I try this on regular zip files created both on Mac and on Windows: zipFile := FileSystem disk workingDirectory / 'tmp.zip'. zip := (FileSystem zip: zipFile) open. (zip / 'sample.txt') readStreamDo: [ :s | s contents ]
The problem is that I get an encoded stream. How do I decode it?
No idea. I donât think that anybody used it after Lukas wrote it. So itâs quite possible that itâs not even fully functional. But if it isnât, then there are a lot of test cases missing (if there are any at all) and we should start writing some right now. I can take a closer look on the weekend if youâre not already finished by then.
Doru
On Fri, Feb 7, 2014 at 6:34 AM, Tudor Girba <tudor@tudorgirba.com> wrote: And I found another problem. Even with the fix, it seems you cannot close the zip file. For example:
zipFile := FileSystem disk workingDirectory / 'test.zip'. zip := (FileSystem zip: zipFile) open. zip / 'sample.txt' writeStreamDo: [ :stream | stream nextPutAll: 'xyz' ]. zip close
I think the code should be correct.
Cheers, Doru
On Fri, Feb 7, 2014 at 5:49 AM, Tudor Girba <tudor@tudorgirba.com> wrote: Ok.
I added an initial slice with the quick fix solution: https://pharo.fogbugz.com/f/cases/12826/Zip-FileSystem-does-not-work
Could someone double check?
Do we want to work more on it for Pharo 3.0?
Cheers, Doru
On Thu, Feb 6, 2014 at 4:37 PM, Max Leske <maxleske@gmail.com> wrote: Yeah I know⦠Itâs all just one big hack at the moment (Iâm not particularly proud of #binaryReadStream eitherâ¦). Again: letâs hope that XStreams will solve all our problems :)
On 06.02.2014, at 15:33, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 06 Feb 2014, at 15:30, Max Leske <maxleske@gmail.com> wrote:
No, not my bug :)
The problem seems to be that WriteStream expects #size to be implemented but MemoryFileSystemFile only knows #fileSize. Apart from that I think it would work.
But again, this is a problem (of the (G)Zip implementation) regarding the stream API. Certain stream, like network or serial streams, cannot respond to size in all conditions.
Add this to MemoryFileSystemFile (not as a final solution!):
size ^ bytes size
Cheers, Max
On 06.02.2014, at 15:22, Tudor Girba <tudor@tudorgirba.com> wrote:
Thanks, Max.
Doru
On Thu, Feb 6, 2014 at 3:11 PM, Max Leske <maxleske@gmail.com> wrote: On 06.02.2014, at 15:07, Tudor Girba <tudor@tudorgirba.com> wrote:
I am trying to get the ZipFileSystem to work, but I cannot quite manage it.
I am doing this: (FileSystem zip: (FileSystem disk workingDirectory / 'sample.zip')) open
and I get an error.
The error comes from the fact that the code uses readStreamDo: which does not work anymore with binary streams. I tried to use binaryReadStreamDo:, but that crashes in another place.
I think this is a bug. Or am I doing something wrong?
You shouldnât be⦠Iâll take a look later since that would be me who introduced the bug (probably).
Cheers, Doru
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com
"Every thing has its own flow"