// Generates a tarball including all the requested entries // @return tarball path public string GenerateTarball() { string tmpDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")); try { // TODO: check if space left? Directory.CreateDirectory(tmpDir); string outDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")); Directory.CreateDirectory(outDir); this.UsedDirectories.Add(outDir); CopyFiles(tmpDir); string tarballPath = Path.Combine(outDir, "files.tgz"); FileArchive.ZipFile(tmpDir, tarballPath); return(tarballPath); } finally { if (!string.IsNullOrEmpty(tmpDir) && Directory.Exists(tmpDir)) { Directory.Delete(tmpDir, true); } } }
internal static void PackBlob(string directory, string fileName) { FileArchive.ZipFile(directory, fileName); }