Написал скриптик, который архивирует папку. Давно пора было так сделать.
using System.IO;
using System.IO.Compression;
using UnityEngine;
public class ZipFolderUtility
{
public static void ZipFolder(string folderPath)
{
if (!Directory.Exists(folderPath))
{
Debug.LogError("Folder does not exist: " + folderPath);
return;
}
var zipName = $"{Path.GetFileName(folderPath)}.zip";
var zipPath = $"{folderPath}/{zipName}";
var oldZipPath = $"{folderPath}/_{zipName}";
if (File.Exists(oldZipPath))
File.Delete(oldZipPath);
if (File.Exists(zipPath))
File.Move(zipPath, oldZipPath);
using var zipToOpen = new FileStream(zipPath, FileMode.Create);
using var archive = new ZipArchive(zipToOpen, ZipArchiveMode.Create);
var files = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories);
foreach (var filePath in files)
{
var entryName = filePath.Substring(folderPath.Length + 1).Replace("\\", "/");
if (entryName.EndsWith(zipName))
continue;
archive.CreateEntryFromFile(filePath, entryName);
}
Debug.Log("ZIP created: " + zipPath);
}
}
#яндекс_игры