refactor: centralize common strings, paths, and default values into a new Constants class.
This commit is contained in:
@@ -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)!);
|
||||
|
||||
Reference in New Issue
Block a user