Files
ersatztv/ErsatzTV.Infrastructure/Health/Checks/MacOsConfigFolderHealthCheck.cs
T
Jason DoveandGitHub d78110f6f1 fix macos config folder regression (#1682)
* migrate macos config folder on startup, if needed

* add macos config folder health check

* update macos fix; update changelog
2024-04-17 09:18:09 -05:00

30 lines
1.0 KiB
C#

using System.Runtime.InteropServices;
using ErsatzTV.Core;
using ErsatzTV.Core.Health;
using ErsatzTV.Core.Health.Checks;
namespace ErsatzTV.Infrastructure.Health.Checks;
public class MacOsConfigFolderHealthCheck : BaseHealthCheck, IMacOsConfigFolderHealthCheck
{
public override string Title => "MacOS Config Folder";
public Task<HealthCheckResult> Check(CancellationToken cancellationToken)
{
// only applies to macos
if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return NotApplicableResult().AsTask();
}
if (Directory.Exists(FileSystemLayout.MacOsOldAppDataFolder))
{
var message =
$"Old config data exists; to migrate: exit ETV, backup the folder {FileSystemLayout.AppDataFolder} to another location, and restart ETV. Otherwise, move the old folder {FileSystemLayout.MacOsOldAppDataFolder} to another location to remove this message";
return FailResult(message).AsTask();
}
return NotApplicableResult().AsTask();
}
}