Support .demo and .map files being dragged into client

Only tested on macOS, but should work everywhere
This commit is contained in:
Dennis Felsing 2022-12-24 00:50:36 +01:00
parent bfe4ced662
commit 779b44fde5
2 changed files with 32 additions and 2 deletions

View file

@ -29,6 +29,29 @@
</array>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>DDNet demo</string>
<key>CFBundleTypeRole</key>
<string>DDNet demo viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>dyn.ah62d4rv4ge80k3prr6</string>
<string>public.data</string>
</array>
<key>CFBundleTypeName</key>
<string>DDNet map</string>
<key>CFBundleTypeRole</key>
<string>DDNet map editor</string>
<key>LSItemContentTypes</key>
<array>
<string>dyn.ah62d4rv4ge8042pu</string>
<string>public.data</string>
</array>
</dict>
</array>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSPrefersDisplaySafeAreaCompatibilityMode</key>

View file

@ -3177,8 +3177,15 @@ void CClient::Run()
}
char aFile[IO_MAX_PATH_LENGTH];
if(Input()->GetDropFile(aFile, sizeof(aFile)) && str_startswith(aFile, CONNECTLINK_NO_SLASH))
HandleConnectLink(aFile);
if(Input()->GetDropFile(aFile, sizeof(aFile)))
{
if(str_startswith(aFile, CONNECTLINK_NO_SLASH))
HandleConnectLink(aFile);
else if(str_endswith(aFile, ".demo"))
HandleDemoPath(aFile);
else if(str_endswith(aFile, ".map"))
HandleMapPath(aFile);
}
#if defined(CONF_AUTOUPDATE)
Updater()->Update();