1 Commits
Author SHA1 Message Date
whoswhip 4f4701ac1e fix: use local app data on linux; try "Rhythia" as well 2026-11-22 13:12:46 -05:00
+21 -7
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; namespace RhythiaReplayExporter;
class Program class Program
{ {
static void Main(string[] args) 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)) if (string.IsNullOrWhiteSpace(appData))
{ {
Console.WriteLine("Failed to find app data folder."); Console.WriteLine("Failed to find app data folder.");
@@ -17,9 +23,13 @@ class Program
string rhythia = Path.Combine(appData, "CapoRhythia"); string rhythia = Path.Combine(appData, "CapoRhythia");
if (!Directory.Exists(rhythia)) if (!Directory.Exists(rhythia))
{ {
Console.WriteLine("CapoRhythia directory doesn't exist in app data."); rhythia = Path.Combine(appData, "Rhythia");
Environment.Exit(1); if (!Directory.Exists(rhythia))
return; {
Console.WriteLine("Neither CapoRhythia or Rhythia exists in app data.");
Environment.Exit(1);
return;
}
} }
string database = Path.Combine(rhythia, "rhythia.db"); string database = Path.Combine(rhythia, "rhythia.db");
@@ -47,7 +57,11 @@ class Program
int count = 0; int count = 0;
while (reader.Read()) 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); string legacyMapId = reader.GetString(1);
byte[] replay = reader.GetFieldValue<byte[]>(2); byte[] replay = reader.GetFieldValue<byte[]>(2);