From 8e7bd4b98a5f48df053a866c48ab2cbaf12ca931 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 23 Dec 2025 10:51:52 +0100 Subject: [PATCH] fix: File provider not erroring out correctly when selecting a folder to open --- plugins/builtin/romfs/lang/en_US.json | 1 + plugins/builtin/source/content/providers/file_provider.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json index 9b22b7d8e..fcb8e1145 100644 --- a/plugins/builtin/romfs/lang/en_US.json +++ b/plugins/builtin/romfs/lang/en_US.json @@ -443,6 +443,7 @@ "hex.builtin.provider.file": "Regular File", "hex.builtin.provider.file.error.open": "Failed to open file {}: {}", "hex.builtin.provider.file.error.already_open": "Same file is already open", + "hex.builtin.provider.file.error.is_directory": "Selected entry '{}' is a directory", "hex.builtin.provider.file.access": "Last access time", "hex.builtin.provider.file.creation": "Creation time", "hex.builtin.provider.file.menu.direct_access": "Direct access file", diff --git a/plugins/builtin/source/content/providers/file_provider.cpp b/plugins/builtin/source/content/providers/file_provider.cpp index 89f7c5764..00fc74ebb 100644 --- a/plugins/builtin/source/content/providers/file_provider.cpp +++ b/plugins/builtin/source/content/providers/file_provider.cpp @@ -235,6 +235,9 @@ namespace hex::plugin::builtin { m_readable = true; m_writable = true; + if (wolv::io::fs::isDirectory(m_path)) + return OpenResult::failure(fmt::format("hex.builtin.provider.file.error.is_directory"_lang, m_path.string())); + wolv::io::File file(m_path, wolv::io::File::Mode::Write); if (!file.isValid()) { m_writable = false;