From e5aee5adf699f44180fc3916c3257fd28fa8d720 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 5 Sep 2022 12:53:21 +0100 Subject: [PATCH] open-browser: always prefix paths with file:// Make opening a local file explicit as a URI, on all platforms (before, this was only done on macOS) --- src/GUI/gui_funcs.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index 35be1c37e..edf117c35 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -180,10 +180,9 @@ bool openBrowser(const std::string& aAddress) // resolve local file path SGPath path(address); path = globals->resolve_maybe_aircraft_path(address); - if (!path.isNull()) - address = path.local8BitStr(); - else - { + if (!path.isNull()) { + address = "file://" + path.local8BitStr(); + } else { mkDialog ("Sorry, file not found!"); SG_LOG(SG_GENERAL, SG_ALERT, "openBrowser: Cannot find requested file '" << address << "'."); @@ -192,10 +191,6 @@ bool openBrowser(const std::string& aAddress) } #ifdef SG_MAC - if (address.find("://")==string::npos) { - address = "file://" + address; - } - cocoaOpenUrl(address); #elif defined _WIN32