sdl: add patch to fetch application signature from resources

This avoids warnings like:
Signature in rsrc doesn't match constructor arg.
(application/x-SDL-executable, application/x-vnd.oricutron)

It also avoid roster messing around with applications it things are the same.
This commit is contained in:
François Revol
2016-07-11 15:32:16 +02:00
parent 3401334604
commit 46a1381866
2 changed files with 53 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ joystick, and graphics via OpenGL."
HOMEPAGE="http://www.libsdl.org/"
COPYRIGHT="1997-2012 Sam Lantinga"
LICENSE="GNU LGPL v2.1"
REVISION="9"
REVISION="10"
SOURCE_URI="http://www.libsdl.org/release/SDL-1.2.15.tar.gz"
CHECKSUM_SHA256="d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00"
SOURCE_DIR="SDL-$portVersion"

View File

@@ -501,3 +501,55 @@ index 818d1a0..0100f3b 100644
--
2.2.2
From d7ef3da5dc491445e50eb4f915d00d7d4b722fe4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Mon, 11 Jul 2016 15:08:06 +0200
Subject: Try to find correct application signature from app resources
Instead of always hardcoding application/x-SDL-executable.
diff --git a/src/main/beos/SDL_BeApp.cc b/src/main/beos/SDL_BeApp.cc
index 8b79377..65a6dbf 100644
--- a/src/main/beos/SDL_BeApp.cc
+++ b/src/main/beos/SDL_BeApp.cc
@@ -24,8 +24,10 @@
/* Handle the BeApp specific portions of the application */
#include <AppKit.h>
+#include <storage/AppFileInfo.h>
#include <storage/Path.h>
#include <storage/Entry.h>
+#include <storage/File.h>
#include <unistd.h>
#include "SDL_BeApp.h"
@@ -42,7 +44,24 @@ static int StartBeApp(void *unused)
if(!be_app) {
BApplication *App;
- App = new BApplication("application/x-SDL-executable");
+ // default application signature
+ const char *signature = "application/x-SDL-executable";
+ // dig resources for correct signature
+ image_info info;
+ int32 cookie = 0;
+ if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
+ BFile f(info.name, O_RDONLY);
+ if (f.InitCheck() == B_OK) {
+ BAppFileInfo app_info(&f);
+ if (app_info.InitCheck() == B_OK) {
+ char sig[B_MIME_TYPE_LENGTH];
+ if (app_info.GetSignature(sig) == B_OK)
+ signature = strndup(sig, B_MIME_TYPE_LENGTH);
+ }
+ }
+ }
+
+ App = new BApplication(signature);
App->Run();
delete App;
--
2.8.0