From 8bb6fb902be399b915157eae2e3168a3948738df Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 1 Jun 2023 18:28:58 +0200 Subject: [PATCH] File Permissions --- Tranga/Connector.cs | 4 ++++ Tranga/Publication.cs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Tranga/Connector.cs b/Tranga/Connector.cs index 24e6ad2..95804e0 100644 --- a/Tranga/Connector.cs +++ b/Tranga/Connector.cs @@ -1,7 +1,9 @@ using System.IO.Compression; using System.Net; +using System.Runtime.InteropServices; using System.Xml.Linq; using Logging; +using static System.IO.UnixFileMode; namespace Tranga; @@ -171,6 +173,8 @@ public abstract class Connector logger?.WriteLine("Connector", $"Creating archive {saveArchiveFilePath}"); //ZIP-it and ship-it ZipFile.CreateFromDirectory(tempFolder, saveArchiveFilePath); + if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + File.SetUnixFileMode(saveArchiveFilePath, GroupRead | GroupWrite | OtherRead | OtherWrite | UserRead | UserWrite); Directory.Delete(tempFolder, true); //Cleanup } diff --git a/Tranga/Publication.cs b/Tranga/Publication.cs index 8eff7e3..3cad737 100644 --- a/Tranga/Publication.cs +++ b/Tranga/Publication.cs @@ -1,6 +1,8 @@ -using System.Text; +using System.Runtime.InteropServices; +using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; +using static System.IO.UnixFileMode; namespace Tranga; @@ -56,6 +58,8 @@ public readonly struct Publication string seriesInfoPath = Path.Join(publicationFolder, "series.json"); if(!File.Exists(seriesInfoPath)) File.WriteAllText(seriesInfoPath,this.GetSeriesInfoJson()); + if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + File.SetUnixFileMode(seriesInfoPath, GroupRead | GroupWrite | OtherRead | OtherWrite | UserRead | UserWrite); } /// Serialized JSON String for series.json