I try to zip three files which I place in my temporary files directory (%temp%). When zipping them with SevenZipSharp I get a zip file with an unnamed folder in it. Within this folder I have my three files but I need the files to be in the root of the Zip. What am I missing here, what am I doing wrong?
public void ZipFiles(String[] files, String absoluteDestination)
{
List<String> createdFiles = HandleFileIgnore(files);
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("de-DE");
SevenZipCompressor compressor = new SevenZipCompressor(m_TempPath);
compressor.ArchiveFormat = m_outArchiveFormat; //OutArchiveFormat.Zip
compressor.PreserveDirectoryRoot = true; //False doesn't solve the problem
compressor.Compressing += CompressingProgressChanged;
int commonrootlenght = FindCommonRoot(files, m_CommonRootFolder); //if no commonRootFolder is set it will return -1
CompressFilesFromRoot(files, absoluteDestination, compressor, commonrootlenght);
RemoveCreatedFiles(createdFiles);
}
private static void CompressFilesFromRoot(String[] files, String absoluteDestination, SevenZipCompressor compressor, int commonrootlenght)
{
if (commonrootlenght < 0)
{
compressor.CompressFiles(absoluteDestination, files);
}
else
{
compressor.CompressFiles(absoluteDestination, commonrootlenght, files);
}
}