ZeroK-RTS / Zero-K-Infrastructure

Website, lobby launcher and server, steam deployment, .NET based tools and other vital parts of Zero-K infrastructure
GNU General Public License v3.0
53 stars 52 forks source link

ChobbyLa under Mono fails to open links #2857

Closed Anarchid closed 2 years ago

Anarchid commented 2 years ago
Error opening URL http://zero-k.info/mediawiki/index.php?title=Manual : Cannot find the specified file
  at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo)
  at System.Diagnostics.Process.Start () 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
  at System.Diagnostics.Process.Start (System.String fileName) 
  at ChobbyLauncher.ChobbylaLocalListener.Process (ChobbyLauncher.OpenUrl args) 

Likely cause: https://github.com/ZeroK-RTS/Zero-K-Infrastructure/blob/548b4c34d119da21a309e405dbf56f107151c04e/ChobbyLauncher/ChobbylaLocalListener.cs#L160 calls Process.Start(String) , which mono refuses with a "File Not Found".

Probably should be Process.Start("xdg-open", url) if on Linux.

Porkch0p commented 2 years ago

If it clarifies anything, my "hybrid" itch install with both launchers, when started from Zero-K_linux64.sh is still able to open web links in Firefox, but the kickstart throws the above error.

Porkch0p commented 2 years ago

That above error was shortened for readability but seems to have lost some important info in the process. The full first line was Zero-K.exe Error: 0 : Error opening URL http://zero-k.info/mediawiki/index.php?title=Manual : System.ComponentModel.Win32Exception (0x80004005): Cannot find the specified file

It might be possible to support opening urls in mono without breaking current systems if Win32Exception were to be handled and given the suggested Linux parameters.

try
{
  Process.Start(url);
}
catch (Win32Exception)
{
  Process.Start("xdg-open", url);
}
Porkch0p commented 2 years ago

Win32Exception + xdg-open combo works well to open the system default browser on Mono. Tested a built executable based on master. Native steam zk version and windows steam zk version appear unaffected by the change.

mojjj commented 2 years ago

just tried again using steam update to get latest game, but same error again. is this really fixed (and not yet served) ?

https://pastebin.com/Rnm0P3ub