[1.3.1] Linux: Can't open URLs without CEF or awesomium
Posted: Thu Apr 23, 2015 9:30 am
Hi,
I tag this against 1.3.1 which is the current version, but this issue exists still at least 1.2.0 and maybe earlier releases too.
If TE4 is built without support for an embedded browser like CEF or awesomium, clicking on the URLs in the main menu is supposed to open the said URLs in the user's default browser. It does not work on Linux because the code tries to call open %s before trying xdg-open %s, but open is a valid command on Linux that is not meant to open URLs (on my system open is described as "A tool which will start a program on a virtual console"). So the command "succeeds" and the other possibilities are not tried, but the URL is not actually opened.
The problematic code is in engine/utils.lua in game/engines/te4-1.3.1.teae, in the function defined from line 2261:
Maybe putting the xdg-open %s instruction before OSX's open %s would do the trick? Or would it be problematic on OSX?
I tag this against 1.3.1 which is the current version, but this issue exists still at least 1.2.0 and maybe earlier releases too.
If TE4 is built without support for an embedded browser like CEF or awesomium, clicking on the URLs in the main menu is supposed to open the said URLs in the user's default browser. It does not work on Linux because the code tries to call open %s before trying xdg-open %s, but open is a valid command on Linux that is not meant to open URLs (on my system open is described as "A tool which will start a program on a virtual console"). So the command "succeeds" and the other possibilities are not tried, but the URL is not actually opened.
The problematic code is in engine/utils.lua in game/engines/te4-1.3.1.teae, in the function defined from line 2261:
Code: Select all
function util.browserOpenUrl(url, forbid_methods)
forbid_methods = forbid_methods or {}
if forbid_methods.is_external and config.settings.open_links_external then
forbid_methods.webview = true
forbid_methods.steam = true
end
if core.webview and not forbid_methods.webview then local d = require("engine.ui.Dialog"):webPopup(url) if d then return "webview", d end end
if core.steam and not forbid_methods.steam and core.steam.openOverlayUrl(url) then return "steam", true end
if forbid_methods.native then return false end
local tries = {
"rundll32 url.dll,FileProtocolHandler %s", -- Windows
"open %s", -- OSX
"xdg-open %s", -- Linux - portable way
"gnome-open %s", -- Linux - Gnome
"kde-open %s", -- Linux - Kde
"firefox %s", -- Linux - try to find something
"mozilla-firefox %s", -- Linux - try to find something
"google-chrome-stable %s", -- Linux - try to find something
"google-chrome %s", -- Linux - try to find something
}
while #tries > 0 do
local urlbase = table.remove(tries, 1)
urlbase = urlbase:format(url)
print("Trying to run URL with command: ", urlbase)
if os.execute(urlbase) == 0 then return "native", true end
end
return false
end