try this
This commit is contained in:
@@ -107,8 +107,13 @@ namespace anm2ed::imgui
|
|||||||
auto open_directory = [&](anm2::Sound& sound)
|
auto open_directory = [&](anm2::Sound& sound)
|
||||||
{
|
{
|
||||||
if (sound.path.empty()) return;
|
if (sound.path.empty()) return;
|
||||||
filesystem::WorkingDirectory workingDirectory(document.directory_get());
|
std::error_code ec{};
|
||||||
dialog.file_explorer_open(sound.path.parent_path());
|
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 = [&]()
|
auto copy = [&]()
|
||||||
|
|||||||
@@ -123,8 +123,14 @@ namespace anm2ed::imgui
|
|||||||
auto open_directory = [&](anm2::Spritesheet& spritesheet)
|
auto open_directory = [&](anm2::Spritesheet& spritesheet)
|
||||||
{
|
{
|
||||||
if (spritesheet.path.empty()) return;
|
if (spritesheet.path.empty()) return;
|
||||||
filesystem::WorkingDirectory workingDirectory(document.directory_get());
|
std::error_code ec{};
|
||||||
dialog.file_explorer_open(spritesheet.path.parent_path());
|
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 = [&]()
|
auto copy = [&]()
|
||||||
|
|||||||
Reference in New Issue
Block a user