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:
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ReminderOrganizer.Services;
|
||||
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).
|
||||
ds.MigrateFrom(System.IO.Path.GetDirectoryName(Environment.ProcessPath));
|
||||
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;
|
||||
});
|
||||
services.AddSingleton<INotificationService, NotificationService>();
|
||||
@@ -35,3 +49,4 @@ namespace ReminderOrganizer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user