1
0
Fork 0

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)
This commit is contained in:
James Turner 2022-09-05 12:53:21 +01:00
parent 91ddbf6a7c
commit e5aee5adf6

View file

@ -180,10 +180,9 @@ bool openBrowser(const std::string& aAddress)
// resolve local file path // resolve local file path
SGPath path(address); SGPath path(address);
path = globals->resolve_maybe_aircraft_path(address); path = globals->resolve_maybe_aircraft_path(address);
if (!path.isNull()) if (!path.isNull()) {
address = path.local8BitStr(); address = "file://" + path.local8BitStr();
else } else {
{
mkDialog ("Sorry, file not found!"); mkDialog ("Sorry, file not found!");
SG_LOG(SG_GENERAL, SG_ALERT, "openBrowser: Cannot find requested file '" SG_LOG(SG_GENERAL, SG_ALERT, "openBrowser: Cannot find requested file '"
<< address << "'."); << address << "'.");
@ -192,10 +191,6 @@ bool openBrowser(const std::string& aAddress)
} }
#ifdef SG_MAC #ifdef SG_MAC
if (address.find("://")==string::npos) {
address = "file://" + address;
}
cocoaOpenUrl(address); cocoaOpenUrl(address);
#elif defined _WIN32 #elif defined _WIN32