Migrate tasks.json from v1.0 single-file extract dir

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 14:09:16 +01:00
parent 1918712f7f
commit 09226b629b
2 changed files with 19 additions and 2 deletions

View File

@@ -2,7 +2,9 @@
"permissions": { "permissions": {
"allow": [ "allow": [
"PowerShell(node D:\\\\Oculusquest\\\\Projekt\\\\_Tools\\\\Library\\\\tools\\\\project-check.mjs \"d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer\")", "PowerShell(node D:\\\\Oculusquest\\\\Projekt\\\\_Tools\\\\Library\\\\tools\\\\project-check.mjs \"d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer\")",
"PowerShell(cd d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer; git rm -q --cached tasks.json docs/screenshots/1.png; Remove-Item tasks.json, docs\\\\screenshots\\\\1.png; Add-Content .gitignore \"tasks.json\"; Get-ChildItem bin -Recurse -Filter tasks.json | Remove-Item; dotnet build ReminderOrganizer.csproj -nologo -v q 2>&1 | Select-String \"Fehler|error\" ; Test-Path \"$env:APPDATA\\\\ReminderOrganizer\")" "PowerShell(cd d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer; git rm -q --cached tasks.json docs/screenshots/1.png; Remove-Item tasks.json, docs\\\\screenshots\\\\1.png; Add-Content .gitignore \"tasks.json\"; Get-ChildItem bin -Recurse -Filter tasks.json | Remove-Item; dotnet build ReminderOrganizer.csproj -nologo -v q 2>&1 | Select-String \"Fehler|error\" ; Test-Path \"$env:APPDATA\\\\ReminderOrganizer\")",
"PowerShell(Get-ChildItem \"$env:TEMP\\\\.net\\\\ReminderOrganizer\" -Recurse -Filter tasks.json -ErrorAction SilentlyContinue | select FullName,Length,LastWriteTime)",
"PowerShell(cd d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer; if \\(-not \\(Select-String -Path ServiceLocator.cs -Pattern \"using System.Linq\" -Quiet\\)\\) { \\(Get-Content -Raw ServiceLocator.cs\\) -replace \"using System;\",\"using System;`r`nusing System.Linq;\" | Set-Content -Encoding utf8 ServiceLocator.cs }; dotnet build ReminderOrganizer.csproj -nologo -v q 2>&1 | Select-String \"Fehler|error\"; git commit -qam \"Migrate tasks.json from v1.0 single-file extract dir`n`nCo-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>\"; node D:\\\\Oculusquest\\\\Projekt\\\\_Tools\\\\Library\\\\tools\\\\project-check.mjs \"d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer\")"
] ]
} }
} }

View File

@@ -1,5 +1,6 @@
#nullable enable #nullable enable
using System; using System;
using System.Linq;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using ReminderOrganizer.Services; using ReminderOrganizer.Services;
using ReminderOrganizer.ViewModels; using ReminderOrganizer.ViewModels;
@@ -23,6 +24,19 @@ namespace ReminderOrganizer
// Older versions stored tasks.json next to the exe (or in the single-file extract dir). // Older versions stored tasks.json next to the exe (or in the single-file extract dir).
ds.MigrateFrom(System.IO.Path.GetDirectoryName(Environment.ProcessPath)); ds.MigrateFrom(System.IO.Path.GetDirectoryName(Environment.ProcessPath));
ds.MigrateFrom(AppContext.BaseDirectory); ds.MigrateFrom(AppContext.BaseDirectory);
// v1.0 single-file builds extracted to %TEMP%\.net\ReminderOrganizer\<hash>\ and saved there.
try
{
var extractRoot = System.IO.Path.Combine(System.IO.Path.GetTempPath(), ".net", "ReminderOrganizer");
if (System.IO.Directory.Exists(extractRoot))
{
var newest = new System.IO.DirectoryInfo(extractRoot)
.GetFiles("tasks.json", System.IO.SearchOption.AllDirectories)
.OrderByDescending(f => f.LastWriteTimeUtc).FirstOrDefault();
ds.MigrateFrom(newest?.DirectoryName);
}
}
catch { }
return ds; return ds;
}); });
services.AddSingleton<INotificationService, NotificationService>(); services.AddSingleton<INotificationService, NotificationService>();
@@ -35,3 +49,4 @@ namespace ReminderOrganizer
} }
} }
} }