From 357b7d4462c2e663868188add57f0d9cbff3d5e0 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 18 Jul 2026 21:48:18 +0200 Subject: [PATCH] vfs: add source location to exception --- rpcs3/Emu/VFS.cpp | 8 ++++---- rpcs3/Emu/VFS.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/VFS.cpp b/rpcs3/Emu/VFS.cpp index 2f05ffb557..0133fe583f 100644 --- a/rpcs3/Emu/VFS.cpp +++ b/rpcs3/Emu/VFS.cpp @@ -194,13 +194,13 @@ bool vfs::unmount(std::string_view vpath) return true; } -std::string vfs::get(std::string_view vpath, std::vector* out_dir, std::string* out_path) +std::string vfs::get(std::string_view vpath, std::vector* out_dir, std::string* out_path, std::source_location src_loc) { // Just to make the code more robust. // It should never happen because we take care to initialize Emu (and so also vfs_manager) with Emu.Init() before this function is invoked if (!g_fxo->is_init()) { - fmt::throw_exception("vfs_manager not initialized"); + fmt::throw_exception("vfs_manager not initialized.%s", src_loc); } auto& table = g_fxo->get(); @@ -377,13 +377,13 @@ std::string vfs::get(std::string_view vpath, std::vector* out_dir, using char2 = char8_t; -std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std::vector* mount_path) +std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std::vector* mount_path, std::source_location src_loc) { // Just to make the code more robust. // It should never happen because we take care to initialize Emu (and so also vfs_manager) with Emu.Init() before this function is invoked if (!g_fxo->is_init()) { - fmt::throw_exception("vfs_manager not initialized"); + fmt::throw_exception("vfs_manager not initialized.%s", src_loc); } auto& table = g_fxo->get(); diff --git a/rpcs3/Emu/VFS.h b/rpcs3/Emu/VFS.h index 2872d9a5e2..bf79c8b653 100644 --- a/rpcs3/Emu/VFS.h +++ b/rpcs3/Emu/VFS.h @@ -16,10 +16,10 @@ namespace vfs bool unmount(std::string_view vpath); // Convert VFS path to fs path, optionally listing directories mounted in it - std::string get(std::string_view vpath, std::vector* out_dir = nullptr, std::string* out_path = nullptr); + std::string get(std::string_view vpath, std::vector* out_dir = nullptr, std::string* out_path = nullptr, std::source_location src_loc = std::source_location::current()); // Convert fs path to VFS path - std::string retrieve(std::string_view path, const vfs_directory* node = nullptr, std::vector* mount_path = nullptr); + std::string retrieve(std::string_view path, const vfs_directory* node = nullptr, std::vector* mount_path = nullptr, std::source_location src_loc = std::source_location::current()); // Escape VFS name by replacing non-portable characters with surrogates std::string escape(std::string_view name, bool escape_slash = false);