umbraco / UmbPack

13 stars 13 forks source link

Maintain folder structure in zip file #39

Open mattbrailsford opened 4 years ago

mattbrailsford commented 4 years ago

Currently when generating the package.xml file + zip files, all files are flattened into a root directory, except where file names would overlap then the file is prefixed with a guid.

The issue with this is it's hard to debug a package file and it's contents as you can't tell where a file goes without looking through the package.xml file so it would be great if we could maintain the relative folder structure in the zip file. Given the use of ZipFile.CreateFromDirectory which the docs say this maintains folder structures, this should allow us to achieve this.

The only thing I'm not sure of is whether the installer will handle folders ok, but given Umbraco generated zips include a folder, I don't think it should be an issue.

mattbrailsford commented 4 years ago

Hmm, looking at the core source, I'm not sure if it does handle sub folders. Can anyone confirm this?

mattbrailsford commented 4 years ago

Hmm, I don't think core does like sub folders.

One approach we could take is what I currently do for Vendr packages is make the guid the file path like this

image

The only potential issue here is that we currently prepare files in a folder before zipping them up (I don't in my current solution) and so there is the potential that on windows you could generate too long a file name / path for the operating system to handle. I don't think it's a problem during install as from what I can tell, it reads direct from the zip file rather than unzipping the package zip itself.

Shazwazza commented 4 years ago

Yep this is part of a bigger chat about package format and this is one of those quick wins. @jmayntzhusen is writing up more info on moving forward with package formats.