From: Athene Allen Date: Sat, 1 Feb 2025 10:39:54 +0000 (+0000) Subject: modify rssgen for linux compatibility X-Git-Url: https://fortfriendship.online/gitweb/gnargle.github.io.git/commitdiff_plain/d7a192ed0520e86077032d5b9d814077c542da4c?ds=inline modify rssgen for linux compatibility --- diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3d85777 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/RSSGen/bin/Debug/net8.0/RSSGen.dll", + "args": [], + "cwd": "${workspaceFolder}/RSSGen", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..2bcce95 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/RSSGen/RSSGen.sln", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/RSSGen/RSSGen.sln", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/RSSGen/RSSGen.sln" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/RSSGen/Program.cs b/RSSGen/Program.cs index 7204f06..19f6832 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", } };