brendan-duncan / archive

Dart library to encode and decode various archive and compression formats, such as Zip, Tar, GZip, ZLib, and BZip2.
MIT License
400 stars 140 forks source link

Can't modify archive files #309

Closed YancyHsu closed 3 months ago

YancyHsu commented 9 months ago

the code cant work now _archive.files[index] = archiveFile; maybe UnmodifiableListView block it

https://github.com/brendan-duncan/archive/blob/4c94c0a54c08cf3a0bad324e614c6d7bfe1dd835/lib/src/archive.dart#L14

brendan-duncan commented 9 months ago

That had to be removed because it caused the archive's cache to become invalid.

I just pushed an alternative to git, I'll publish soon: _archive[index] = archiveFile;

YancyHsu commented 9 months ago

That had to be removed because it caused the archive's cache to become invalid.

I just pushed an alternative to git, I'll publish soon: _archive[index] = archiveFile;

i modified the \archive-3.4.10\lib\src\archive.dart

List get files => UnmodifiableListView(_files);

to

List get files => _files;

instead temprorily

brendan-duncan commented 9 months ago

I'll have to remove the name caching if I made files a modifiable list, because if you change the list directly, the name cache (_fileMap) could become invalid.