Skip to content

Commit

Permalink
Review Feedback
Browse files Browse the repository at this point in the history
Use "Directory" instead of "Folder" in variable name.
  • Loading branch information
Damon3000s committed Feb 3, 2025
1 parent e4a2334 commit 37af748
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions SingleAppInstance/SingleAppInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace ktsu.SingleAppInstance;
/// </summary>
public static class SingleAppInstance
{
internal static AbsoluteDirectoryPath PidFolderPath { get; } = AppData.Path;
internal static AbsoluteFilePath PidFilePath { get; } = PidFolderPath / $".{nameof(SingleAppInstance)}.pid".As<FileName>();
internal static AbsoluteDirectoryPath PidDirectoryPath { get; } = AppData.Path;
internal static AbsoluteFilePath PidFilePath { get; } = PidDirectoryPath / $".{nameof(SingleAppInstance)}.pid".As<FileName>();

/// <summary>
/// Exits the application if another instance is already running.
Expand Down Expand Up @@ -56,7 +56,8 @@ public static bool ShouldLaunch()

// in case there was a race and another instance is starting at the same time we
// need to check again to see if we won the lock
return !IsAlreadyRunning();

return IsAlreadyRunning();
}

/// <summary>
Expand All @@ -79,7 +80,7 @@ internal static bool IsAlreadyRunning()
if (filePid == currentPid)
{
//if the pid in the file is the same as the current pid, exit
return false;
return true;
}

//is the process still running?
Expand Down Expand Up @@ -110,7 +111,7 @@ internal static bool IsAlreadyRunning()
/// </remarks>
internal static void WritePidFile()
{
Directory.CreateDirectory(PidFolderPath);
Directory.CreateDirectory(PidDirectoryPath);
File.WriteAllText(PidFilePath, Environment.ProcessId.ToString(CultureInfo.InvariantCulture));
}
}

0 comments on commit 37af748

Please sign in to comment.