From 90fbaab2239098b5db26399f184e189d1dc89240 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Sat, 15 Nov 2025 23:17:44 +0500 Subject: [PATCH] rewrite mounted bdvd path check --- CompatBot/Utils/PathUtils.cs | 4 ++-- .../LogParserResultFormatter.GeneralNotesSection.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CompatBot/Utils/PathUtils.cs b/CompatBot/Utils/PathUtils.cs index d1d33665..3f4552a1 100644 --- a/CompatBot/Utils/PathUtils.cs +++ b/CompatBot/Utils/PathUtils.cs @@ -14,9 +14,9 @@ public static class PathUtils do { segment = Path.GetFileName(path); - result.Add(string.IsNullOrEmpty(segment) ? path : segment); + result.Add(segment is {Length: >0} ? segment : path); path = Path.GetDirectoryName(path); - } while (!string.IsNullOrEmpty(segment) && !string.IsNullOrEmpty(path)); + } while (segment is {Length: >0} && path is {Length: >0}); result.Reverse(); return result.ToArray(); } diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs index a074a3c1..08f5ce9b 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs @@ -118,8 +118,9 @@ internal static partial class LogParserResult notes.Add($"⚠️ Retail game booted directly through `{Path.GetFileName(elfBootPath)}`, which is not recommended"); if (items["mounted_dev_bdvd"] is { Length: > 0 } mountedBdvd && items["os_type"] is {Length: >0} osType - && (osType is "Windows" && mountedBdvd.TrimEnd('/').EndsWith(':') - || osType is "MacOS" && mountedBdvd.StartsWith("/Volumes/"))) + && mountedBdvd.Split('/', StringSplitOptions.RemoveEmptyEntries) is {Length: <3} segments + && (osType is "Windows" && segments is [[_, ':']] + || osType is "MacOS" && segments is ["Volumes", _])) { notes.Add("⚠️ Booting directly from blu-ray disc is not supported, please make a proper game dump"); }