From efa9533a52d3317acfcb8c70cdc2ebcfec7fab1a Mon Sep 17 00:00:00 2001 From: shweet Date: Sat, 13 Dec 2025 22:59:53 -0500 Subject: [PATCH] try this --- src/imgui/window/sounds.cpp | 9 +++++++-- src/imgui/window/spritesheets.cpp | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/imgui/window/sounds.cpp b/src/imgui/window/sounds.cpp index 63bfa62..f6c1774 100644 --- a/src/imgui/window/sounds.cpp +++ b/src/imgui/window/sounds.cpp @@ -107,8 +107,13 @@ namespace anm2ed::imgui auto open_directory = [&](anm2::Sound& sound) { if (sound.path.empty()) return; - filesystem::WorkingDirectory workingDirectory(document.directory_get()); - dialog.file_explorer_open(sound.path.parent_path()); + std::error_code ec{}; + auto absolutePath = std::filesystem::weakly_canonical(document.directory_get() / sound.path, ec); + if (ec) absolutePath = document.directory_get() / sound.path; + auto target = std::filesystem::is_directory(absolutePath) ? absolutePath + : std::filesystem::is_directory(absolutePath.parent_path()) ? absolutePath.parent_path() + : document.directory_get(); + dialog.file_explorer_open(target); }; auto copy = [&]() diff --git a/src/imgui/window/spritesheets.cpp b/src/imgui/window/spritesheets.cpp index f9d28c8..9691804 100644 --- a/src/imgui/window/spritesheets.cpp +++ b/src/imgui/window/spritesheets.cpp @@ -123,8 +123,14 @@ namespace anm2ed::imgui auto open_directory = [&](anm2::Spritesheet& spritesheet) { if (spritesheet.path.empty()) return; - filesystem::WorkingDirectory workingDirectory(document.directory_get()); - dialog.file_explorer_open(spritesheet.path.parent_path()); + std::error_code ec{}; + auto absolutePath = std::filesystem::weakly_canonical(document.directory_get() / spritesheet.path, ec); + if (ec) absolutePath = document.directory_get() / spritesheet.path; + auto target = std::filesystem::is_directory(absolutePath) + ? absolutePath + : std::filesystem::is_directory(absolutePath.parent_path()) ? absolutePath.parent_path() + : document.directory_get(); + dialog.file_explorer_open(target); }; auto copy = [&]()