mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-11-19 13:17:07 +00:00
Mark run_bepinex.sh as executable in the Linux and macOS zips (#1420)
Cake's Zip creates each entry with ZipArchive.CreateEntry and copies the bytes, so file modes on disk are never recorded and every file ends up as 0644. run_bepinex.sh therefore isn't executable after extracting, and users have to chmod +x it before ./run_bepinex.sh %command% works. Set its mode to 0755 after packing. Co-authored-by: mirfalltnixein <22786734+mirfalltnixein@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 file changed
+12
-3
+12
-3
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cake.Common;
|
||||
@@ -329,10 +330,18 @@ public sealed class PublishTask : FrostingTask<BuildContext>
|
||||
foreach (var dist in ctx.Distributions)
|
||||
{
|
||||
var targetZipName = $"BepInEx-{dist.Target}-{ctx.BuildPackageVersion}.zip";
|
||||
var targetZipPath = ctx.DistributionDirectory.CombineWithFilePath(targetZipName);
|
||||
ctx.Log.Information($"Packing {targetZipName}");
|
||||
ctx.Zip(ctx.DistributionDirectory.Combine(dist.Target),
|
||||
ctx.DistributionDirectory
|
||||
.CombineWithFilePath(targetZipName));
|
||||
ctx.Zip(ctx.DistributionDirectory.Combine(dist.Target), targetZipPath);
|
||||
|
||||
// Cake's Zip doesn't keep file modes, so mark the start script as executable by hand
|
||||
if (dist.Os is "linux" or "macos")
|
||||
{
|
||||
using var archive = ZipFile.Open(targetZipPath.FullPath, ZipArchiveMode.Update);
|
||||
var startScript = archive.GetEntry("run_bepinex.sh");
|
||||
if (startScript != null)
|
||||
startScript.ExternalAttributes = Convert.ToInt32("100755", 8) << 16;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user