Merge pull request #7934 from Mailaender/mime-join

Registered the openra:// protocol to join games on Linux
This commit is contained in:
Pavel Penev
2015-05-23 22:39:17 +03:00
5 changed files with 37 additions and 4 deletions

View File

@@ -394,6 +394,7 @@ install-linux-mime:
@$(INSTALL_DATA) packaging/linux/openra-mimeinfo.xml "$(DESTDIR)$(datadir)/mime/packages/openra.xml" @$(INSTALL_DATA) packaging/linux/openra-mimeinfo.xml "$(DESTDIR)$(datadir)/mime/packages/openra.xml"
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications" @$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-join-servers.desktop "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-replays.desktop "$(DESTDIR)$(datadir)/applications" @$(INSTALL_DATA) packaging/linux/openra-replays.desktop "$(DESTDIR)$(datadir)/applications"
install-linux-appdata: install-linux-appdata:

View File

@@ -61,7 +61,23 @@ namespace OpenRA.Mods.Common.LoadScreens
} }
// Join a server directly // Join a server directly
var connect = args != null ? args.GetValue("Launch.Connect", null) : null; var connect = string.Empty;
if (args != null)
{
if (args.Contains("Launch.Connect"))
connect = args.GetValue("Launch.Connect", null);
if (args.Contains("Launch.URI"))
{
connect = args.GetValue("Launch.URI", null);
if (connect != null)
{
connect = connect.Replace("openra://", "");
connect = connect.TrimEnd('/');
}
}
}
if (!string.IsNullOrEmpty(connect)) if (!string.IsNullOrEmpty(connect))
{ {
var parts = connect.Split(':'); var parts = connect.Split(':');

View File

@@ -1,3 +0,0 @@
#!/bin/bash
cd ${0%/*}
exec mono OpenRA.Game.exe Launch.Replay="$@"

View File

@@ -0,0 +1,12 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=OpenRA
GenericName=Real Time Strategy Game
Comment=Reimagining of early Westwood Games
Icon=openra
Exec=openra Launch.URI=%U
Terminal=false
NoDisplay=true
Categories=Game;StrategyGame;
MimeType=x-scheme-handler/openra;

View File

@@ -8,4 +8,11 @@
<glob weight="60" pattern="*.orarep"/> <glob weight="60" pattern="*.orarep"/>
</mime-type> </mime-type>
<mime-type type="x-scheme-handler/openra">
<icon name="openra" />
<generic-icon name="applications-games"/>
<comment>OpenRA connect to server scheme</comment>
<glob weight="60" pattern="openra://*"/>
</mime-type>
</mime-info> </mime-info>