last minute issue with write-zip -flattenpaths

Topics: Developer Forum, Project Management Forum
Mar 5, 2007 at 6:44 PM
Please comment.

SingleArchiveWriter -FlattenPath clobbers entries silently
Mar 5, 2007 at 6:55 PM
I have a shelveset ("flattenpaths") that seems to sidestep this issue -- I'd appreciate it if someone (Jachym?) could have a look at my changes. The hack is to check if the ParameterSetName == "Object" and if so, do not enumerate DirectoryInfo objects for files, as a "ls directory\" or "ls -rec directory\" will pipe all required items.


- overridden IsExcludedPath and ExcludePath in SingleArchiveZipWriter to track flattened paths

- check for ParameterSetName == "Object" in WriterBase.ProcessDirectory

AFAICS, it works fine, but this late in the game, I'm a little worried.
Mar 6, 2007 at 12:36 AM
I'm checking in the shelveset -- it changes the behaviour between -Path and InputObject processing for the SingleArchiveZipWriter (the only cmdlet which supports -FlattenPaths), but I think it's a good trade off, and possibly even makes sense.
Mar 6, 2007 at 12:43 AM
btw, the behaviour difference only affects -FlattenPaths when used in conjunction with an -OutputPath (effectively using SingleArchiveZipWriter)

When piping FileSystemObjects, DirectoryInfo objects will not be automatically enumerated and have their files added. This makes dir -rec | write-zip -flattenpaths -output behave much saner.

On the other hand, when using write-zip _directory_ -flattenpaths -output , the directory will be enumerated for files.
Mar 6, 2007 at 5:10 AM
Seems reasonable to me. We can change it in the next rev if it we need too (even though I would like to try to make these cmdlets stable). Makes me wonder if we should have a "beta" status for certain cmdlets just to let folks know that the beta cmdlets may change as we get further with them.