use no null when true

This commit is contained in:
cdwcgt 2023-07-30 02:30:11 +09:00
parent 88a1cf4005
commit 6ad8339c66
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using Microsoft.Win32;
@ -180,7 +181,7 @@ public bool SetIPCLocation(string? path)
/// <returns>Whether an IPC directory was successfully auto-detected.</returns>
public bool AutoDetectIPCLocation() => SetIPCLocation(findStablePath());
private static bool ipcFileExistsInDirectory(string? p) => p != null && File.Exists(Path.Combine(p, "ipc.txt"));
private static bool ipcFileExistsInDirectory([NotNullWhen(true)] string? p) => p != null && File.Exists(Path.Combine(p, "ipc.txt"));
private string? findStablePath()
{
@ -201,7 +202,7 @@ public bool SetIPCLocation(string? path)
string? stableInstallPath = Environment.GetEnvironmentVariable("OSU_STABLE_PATH");
if (ipcFileExistsInDirectory(stableInstallPath))
return stableInstallPath!;
return stableInstallPath;
}
catch
{