From 25f172fae8ba1c06771948afa0a9d0f73807a8a0 Mon Sep 17 00:00:00 2001 From: Susko3 <16479013+Susko3@users.noreply.github.com> Date: Sun, 17 Oct 2021 12:17:38 +0200 Subject: [PATCH] Update usages of OpenInNativeExplorer to use ShowFileInNativeExplorer Also updates WrappedStorage to override ShowFileInNativeExplorer. --- osu.Game/Database/ArchiveModelManager.cs | 6 ++++-- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/IO/WrappedStorage.cs | 2 ++ osu.Game/OsuGame.cs | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 84e33e3f36..0c6b229413 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -462,10 +462,12 @@ namespace osu.Game.Database if (retrievedItem == null) throw new ArgumentException(@"Specified model could not be found", nameof(item)); - using (var outputStream = exportStorage.GetStream($"{getValidFilename(item.ToString())}{HandledExtensions.First()}", FileAccess.Write, FileMode.Create)) + var filename = $"{getValidFilename(item.ToString())}{HandledExtensions.First()}"; + + using (var outputStream = exportStorage.GetStream(filename, FileAccess.Write, FileMode.Create)) ExportModelTo(retrievedItem, outputStream); - exportStorage.OpenInNativeExplorer(); + exportStorage.ShowFileInNativeExplorer(filename); } /// diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 9cd403f409..27e6e2bb1c 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -135,7 +135,7 @@ namespace osu.Game.Graphics Text = $"{fileName} saved!", Activated = () => { - storage.OpenInNativeExplorer(); + storage.ShowFileInNativeExplorer(fileName); return true; } }); diff --git a/osu.Game/IO/WrappedStorage.cs b/osu.Game/IO/WrappedStorage.cs index b9ccc907d9..1e2d53d6fb 100644 --- a/osu.Game/IO/WrappedStorage.cs +++ b/osu.Game/IO/WrappedStorage.cs @@ -72,6 +72,8 @@ namespace osu.Game.IO public override void OpenPathInNativeExplorer(string path) => UnderlyingStorage.OpenPathInNativeExplorer(MutatePath(path)); + public override void ShowFileInNativeExplorer(string filename) => UnderlyingStorage.ShowFileInNativeExplorer(MutatePath(filename)); + public override Storage GetStorageForDirectory(string path) { if (string.IsNullOrEmpty(path)) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 820597488b..a36c1e18e0 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -913,13 +913,15 @@ namespace osu.Game } else if (recentLogCount == short_term_display_limit) { + var logFile = $@"{entry.Target.ToString().ToLowerInvariant()}.log"; + Schedule(() => Notifications.Post(new SimpleNotification { Icon = FontAwesome.Solid.EllipsisH, Text = "Subsequent messages have been logged. Click to view log files.", Activated = () => { - Storage.GetStorageForDirectory("logs").OpenInNativeExplorer(); + Storage.GetStorageForDirectory(@"logs").ShowFileInNativeExplorer(logFile); return true; } }));