bradgearon / unity-3d-package-extract

Simple method to extract .unitypackage files, since it seems to blow up unity on occasion and if you have lots of assets there is a good chance you just want to pull in what you need...
48 stars 10 forks source link

Match file name 'asset' exactly #2

Closed RupW closed 7 years ago

RupW commented 8 years ago

I tried extracting the standard asset .unitypackage files that come with Unity 5.2.3 and I was getting duplicate files. This is because there's now an 'asset.metadata' file in the .tar too:

feda0c18015b3284cabbc0da85254f9a/
feda0c18015b3284cabbc0da85254f9a/asset
feda0c18015b3284cabbc0da85254f9a/asset.meta
feda0c18015b3284cabbc0da85254f9a/pathname
feda0c18015b3284cabbc0da85254f9a/preview.png

and the .Contains("asset") check was also matching that, making two entries in var.assets that try to extract to the same path name.

Also fixes extraction exceptions not reverting to white text for the next extraction.

At first glance it also ought be possible to avoid the temp .tar file - volume seems to have a method that returns a stream. But I haven't tried that yet.

Thanks!