Add love.system.browser

Issue #51 resolved
Seppi created an issue

One of the many useful scripts I have gist'ed on github is the following:

function openURL(url)
  if love._os == 'OS X' then
    os.execute('open "' .. url .. '"')
  elseif love._os == 'Windows' then
    os.execute('start "' .. url .. '"')
  elseif love._os == 'Linux' then
    os.execute('xdg-open "' .. url .. '" &')
  end
end

What would be really nice is to be able to extend this to love-android-sld2 (and if @Alex Szpakowski is listening, the iOS version as well.)

I was thinking:

function love.system.browser(url)

So that it could be implemented as follows:

function openURL(url)
  if love._os == 'OS X' then
    os.execute('open "' .. url .. '"')
  elseif love._os == 'Windows' then
    os.execute('start "' .. url .. '"')
  elseif love._os == 'Linux' then
    os.execute('xdg-open "' .. url .. '" &')
  elseif love._os == 'Android ' or love._os == "iOS" then -- Or whatever the iOS marks as
    love.system.browser(url)
  end
end

Comments (6)

  1. Martin Felis repo owner

    I have added code to make it work from the App side. Using a very experimental 0.9.1 android codebase it does work.

  2. Log in to comment