From 3a59c152508802cdb05a2d5c84008d809699a0cd Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Wed, 2 Jan 2019 17:16:09 +0100 Subject: [PATCH] Add openclonk:// protocol handler (#1657) --- docs/sdk/cmdline.xml | 2 +- openclonk.desktop | 2 +- src/game/C4Application.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/sdk/cmdline.xml b/docs/sdk/cmdline.xml index ddf9c00fe..868df786b 100644 --- a/docs/sdk/cmdline.xml +++ b/docs/sdk/cmdline.xml @@ -56,7 +56,7 @@
Searches for a network game on the specified address and joins it. No local scenario (*.ocs) should be specified. Implies --network.
-
clonk://<Address>/
+
[open]clonk://<Address>/
Same as --join if an address is specified. If "update" is specified as an address, this will cause the engine to perform an update check instead.
diff --git a/openclonk.desktop b/openclonk.desktop index 57d4782da..cd88053c2 100644 --- a/openclonk.desktop +++ b/openclonk.desktop @@ -9,4 +9,4 @@ Icon=openclonk Exec=openclonk Categories=Game;ActionGame;StrategyGame;ArcadeGame; StartupNotify=true -MimeType=x-scheme-handler/clonk; +MimeType=x-scheme-handler/clonk;x-scheme-handler/openclonk; diff --git a/src/game/C4Application.cpp b/src/game/C4Application.cpp index b663ebd8e..f225f436f 100644 --- a/src/game/C4Application.cpp +++ b/src/game/C4Application.cpp @@ -428,10 +428,10 @@ void C4Application::ParseCommandLine(int argc, char * argv[]) Game.RecordStream.Copy(szParameter); } // Direct join by URL - if (SEqual2NoCase(szParameter, "clonk:")) + if (SEqual2NoCase(szParameter, "clonk:") || SEqual2NoCase(szParameter, "openclonk:")) { // Store address - SCopy(szParameter + 6, Game.DirectJoinAddress, _MAX_PATH); + SCopy(SAdvancePast(szParameter, ':'), Game.DirectJoinAddress, _MAX_PATH); SClearFrontBack(Game.DirectJoinAddress, '/'); // Special case: if the target address is "update" then this is used for update initiation by url if (SEqualNoCase(Game.DirectJoinAddress, "update"))