1
0

refactor: centralize common strings, paths, and default values into a new Constants class.

This commit is contained in:
2026-02-28 15:41:40 +01:00
parent 0577640da9
commit 96ccf0ea9a
13 changed files with 80 additions and 38 deletions

View File

@@ -15,19 +15,14 @@ public static class DaemonService
{
public static string GetSocketPath()
{
var runtimeDir = Environment.GetEnvironmentVariable("XDG_RUNTIME_DIR");
if (string.IsNullOrEmpty(runtimeDir))
{
runtimeDir = Path.GetTempPath();
}
return Path.Combine(runtimeDir, "toak.sock");
return Constants.Paths.GetSocketPath();
}
private static FileStream? _lockFile;
public static async Task StartAsync(bool verbose)
{
var lockPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "toak", "daemon.lock");
var lockPath = Constants.Paths.DaemonLockFile;
try
{
Directory.CreateDirectory(Path.GetDirectoryName(lockPath)!);