public void SetupModFolder() { string zipPath = Path.Combine(tempFolder, fileName).Replace("\\", "/"); try { DirectoryInfo info = new DirectoryInfo(zipPath); foreach (var subDirectory in info.GetDirectories()) { subDirectory.Delete(true); } } catch (DirectoryNotFoundException e) { // creating new folder. } catch (Exception e) { Debug.Log(e); } finally { Directory.CreateDirectory(zipPath); } File.WriteAllText(Path.Combine(zipPath, "manifest.xml").Replace("\\", "/"), manifestBuilder.Generate()); for (int i = 0; i < assetBundleNames.Length; i++) { string source = Path.Combine(bundleCachePath, assetBundleNames[i]).Replace("\\", "/"); string dest = Path.Combine(zipPath, "abdata\\" + assetBundleNames[i]).Replace("\\", "/"); Directory.CreateDirectory(Path.Combine( zipPath, Path.GetDirectoryName("abdata\\" + assetBundleNames[i]) ).Replace("\\", "/")); File.Copy(source, dest); } foreach (CSVBuilder builder in csvBuilders) { string path = ""; if (builder.valid) { if (builder.listPath != null) { path = Path.Combine(zipPath, builder.listPath).Replace("\\", "/"); } else { path = Path.Combine(zipPath, builder.typeInfo.listPath).Replace("\\", "/"); } } else { continue; } Directory.CreateDirectory(Path.GetDirectoryName(path)); File.WriteAllText(path, builder.buffer); } }