fix: use local app data on linux; try "Rhythia" as well

This commit is contained in:
2026-11-22 13:12:46 -05:00
parent eae2e3d7da
commit 4f4701ac1e
+22 -8
View File
@@ -1,12 +1,18 @@
using Microsoft.Data.Sqlite;
using System.Globalization;
using System.Globalization;
using System.Runtime.InteropServices;
using Microsoft.Data.Sqlite;
namespace RhythiaReplayExporter;
class Program
{
static void Main(string[] args)
{
string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string appData;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
else
appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (string.IsNullOrWhiteSpace(appData))
{
Console.WriteLine("Failed to find app data folder.");
@@ -17,9 +23,13 @@ class Program
string rhythia = Path.Combine(appData, "CapoRhythia");
if (!Directory.Exists(rhythia))
{
Console.WriteLine("CapoRhythia directory doesn't exist in app data.");
Environment.Exit(1);
return;
rhythia = Path.Combine(appData, "Rhythia");
if (!Directory.Exists(rhythia))
{
Console.WriteLine("Neither CapoRhythia or Rhythia exists in app data.");
Environment.Exit(1);
return;
}
}
string database = Path.Combine(rhythia, "rhythia.db");
@@ -34,7 +44,7 @@ class Program
string replaysDir = Path.Combine(workingDir, "replays");
if (args.Length > 0)
replaysDir = args[0];
Directory.CreateDirectory(replaysDir);
using SqliteConnection con = new($"Data Source={database}");
@@ -47,7 +57,11 @@ class Program
int count = 0;
while (reader.Read())
{
DateTime createdAt = DateTime.ParseExact(reader.GetString(0), "yyyy-MM-dd HH:mm:ss.FFFFFFF", CultureInfo.InvariantCulture);
DateTime createdAt = DateTime.ParseExact(
reader.GetString(0),
"yyyy-MM-dd HH:mm:ss.FFFFFFF",
CultureInfo.InvariantCulture
);
string legacyMapId = reader.GetString(1);
byte[] replay = reader.GetFieldValue<byte[]>(2);