X-Git-Url: https://fortfriendship.online/gitweb/gnargle.github.io.git/blobdiff_plain/1a7eea4f546ec5ead24aa31d7bf884ca482287c1..0644732444cce0832f6277545a177f73a5d7c784:/RSSGen/Program.cs diff --git a/RSSGen/Program.cs b/RSSGen/Program.cs index 7204f06..b6c16b0 100644 --- a/RSSGen/Program.cs +++ b/RSSGen/Program.cs @@ -2,11 +2,22 @@ using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; // See https://aka.ms/new-console-template for more information Console.WriteLine("Scanning entries folder for latest files"); -var filePaths = Directory.EnumerateFiles(Path.Combine(Directory.GetCurrentDirectory(), "../../../../entries")); +var folder = String.Empty; + +if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) +{ + folder = Path.Combine(Directory.GetCurrentDirectory(), "../entries"); +} +else +{ + folder = Path.Combine(Directory.GetCurrentDirectory(), "../../../../entries"); +} +var filePaths = Directory.EnumerateFiles(folder); var fileInfos = new List(); if (filePaths.Any()) @@ -22,7 +33,16 @@ if (filePaths.Any()) Console.WriteLine("Scanning projects folder for latest files"); -filePaths = Directory.EnumerateFiles(Path.Combine(Directory.GetCurrentDirectory(), "../../../../projects")); +if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) +{ + folder = Path.Combine(Directory.GetCurrentDirectory(), "../projects"); +} +else +{ + folder = Path.Combine(Directory.GetCurrentDirectory(), "../../../../projects"); +} + +filePaths = Directory.EnumerateFiles(folder); if (filePaths.Any()) { @@ -49,7 +69,7 @@ myRSS.channel = new rssChannel link1 = new link { href = "https://athene.gay/feed.xml", - rel="self", + rel = "self", type = "application/rss+xml", } }; @@ -79,7 +99,16 @@ foreach (var file in fileInfos) var output = Generator.SerializeRSS(myRSS); -var rssPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../../feed.xml"); +var rssPath = String.Empty; + +if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) +{ + rssPath = Path.Combine(Directory.GetCurrentDirectory(), "../feed.xml"); +} +else +{ + rssPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../../feed.xml"); +} if (File.Exists(rssPath)) {