Working with zipped files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Working with zipped files

Markus Fritsche-4
Hi,

by peeking around in "Deep into Pharo" I thought that

|  zf fr |
fr := 'I:\SAS_Projekte\project.egp' asFileReference.
zf := FileSystem zip: fr.
zf store open.

should be used to open a zip file programmatically. That fails with
"ZnInvalidUTF8: Invalid utf8 input detected"

Looking at MCMczReader, it skips the FileSystem API completely.

In FileSystem-Tests-* I find DiskFileSystemTest and
MemoryFileSystemTest, no ZipFileSystemTest to see how it's supposed to
be done.

Did I do it wrong? Or is FileSystem not yet "finalized" in that area?

Best regards,
   Markus

Reply | Threaded
Open this post in threaded view
|

Re: Working with zipped files

Yuriy Mironenko
Do you want to work with ZIP files, or specifically with MCZ ?

2014-12-09 15:03 GMT+03:00 Markus Fritsche <[hidden email]>:
Hi,

by peeking around in "Deep into Pharo" I thought that

|  zf fr |
fr := 'I:\SAS_Projekte\project.egp' asFileReference.
zf := FileSystem zip: fr.
zf store open.

should be used to open a zip file programmatically. That fails with
"ZnInvalidUTF8: Invalid utf8 input detected"

Looking at MCMczReader, it skips the FileSystem API completely.

In FileSystem-Tests-* I find DiskFileSystemTest and MemoryFileSystemTest, no ZipFileSystemTest to see how it's supposed to be done.

Did I do it wrong? Or is FileSystem not yet "finalized" in that area?

Best regards,
  Markus


Reply | Threaded
Open this post in threaded view
|

Re: Working with zipped files

Markus Fritsche-4
On 2014-12-09 18:19, Юрий Мироненко wrote:
> Do you want to work with ZIP files, or specifically with MCZ ?

Just a zip file with a member called project.xml which I want to
extract, change and rezip...

Best regards,
   Markus

Reply | Threaded
Open this post in threaded view
|

Re: Working with zipped files

hernanmd
| zipArchive fileRef |
zipArchive := ZipArchive new.
fileRef := 'myFile.zip' asFileReference.
[ zipArchive
  readFrom: fileRef fullName;
  extractAllTo: FileSystem workingDirectory ]
ensure: [ zipArchive close ].

2014-12-09 15:03 GMT-03:00 Markus Fritsche <[hidden email]>:
On 2014-12-09 18:19, Юрий Мироненко wrote:
Do you want to work with ZIP files, or specifically with MCZ ?

Just a zip file with a member called project.xml which I want to extract, change and rezip...

Best regards,
  Markus


Reply | Threaded
Open this post in threaded view
|

Re: Working with zipped files

Yuriy Mironenko
In reply to this post by Markus Fritsche-4
General idea was to use ZipArchive instead of MCZ-related code.

If above code fail to work for you, why not publish the file we are talking about? The it will be possible to test the code you are asking for.



2014-12-09 21:03 GMT+03:00 Markus Fritsche <[hidden email]>:
On 2014-12-09 18:19, Юрий Мироненко wrote:
Do you want to work with ZIP files, or specifically with MCZ ?

Just a zip file with a member called project.xml which I want to extract, change and rezip...

Best regards,
  Markus


Reply | Threaded
Open this post in threaded view
|

Re: Working with zipped files

Markus Fritsche-4
In reply to this post by hernanmd
On 2014-12-09 20:47, Hernán Morales Durand wrote:
> | zipArchive fileRef |
> zipArchive := ZipArchive new.
> fileRef := 'myFile.zip' asFileReference.
> [ zipArchive
>   readFrom: fileRef fullName;
>   extractAllTo: FileSystem workingDirectory ]
> ensure: [ zipArchive close ].

Thank you!

Reply | Threaded
Open this post in threaded view
|

Re: Working with zipped files

Markus Fritsche-4
In reply to this post by Yuriy Mironenko
On 2014-12-10 01:23, Юрий Мироненко wrote:
> General idea was to use ZipArchive instead of MCZ-related code.

Sorry, I wasn't clear. MCZ was just my example. The real question was,
if the ZipFileSystem API can be used or not... I will go with ZipArchive
and friends then.