OpenURL Bug in Linux, now with sample code!

BlitzMax Forums/BlitzMax Bug Reports/OpenURL Bug in Linux, now with sample code!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Does this work, or does it have the same problems?

SuperStrict

Framework BRL.System
Import BRL.StandardIO


Print OpenURL2("http://blitzmax.com")



Function OpenURL2:Int( url:String)

?Not linux
	OpenURL(url)
?linux
Extern "c"
Function sys:Int( cmd:Byte Ptr ) ="system_"
End Extern

	Local s:Byte Ptr
	Local ret:Int
	
	If getenv_("KDE_FULL_DESKTOP")
		s = ("kfmclient exec ~q"+url+"~q").ToCString()
	ElseIf getenv_("GNOME_DESKTOP_SESSION_ID")
		s = ("gnome-open ~q"+url+"~q").ToCString()
	EndIf

	If s Then	
		ret = sys(s)
		MemFree(s)
	End If
	
	Return ret
?

End Function