mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 01:06:16 +02:00
Open OPKs only if compatible with the current platform
This commit is contained in:
parent
d4c086a64d
commit
c6a83e1ed7
@ -73,6 +73,7 @@ esac
|
||||
|
||||
AC_SUBST(PLATFORM)
|
||||
AC_SUBST(SCREEN_RES)
|
||||
AC_DEFINE_UNQUOTED(PLATFORM, "${PLATFORM}")
|
||||
|
||||
|
||||
AC_OUTPUT(Makefile src/Makefile data/Makefile)
|
||||
|
@ -86,17 +86,40 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
||||
|
||||
struct ParserData *pdata = opk_open(linkfile);
|
||||
char *param;
|
||||
bool has_metadata = false;
|
||||
|
||||
if (!pdata) {
|
||||
ERROR("Unable to initialize libopk\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!opk_open_metadata(pdata)) {
|
||||
ERROR("OPK does not contain any meta-data\n");
|
||||
for(;;) {
|
||||
const char *str = opk_open_metadata(pdata);
|
||||
if (!str)
|
||||
break;
|
||||
|
||||
/* Strip .desktop */
|
||||
string metadata(str);
|
||||
pos = metadata.rfind('.');
|
||||
metadata = metadata.substr(0, pos);
|
||||
|
||||
/* Keep only the platform name */
|
||||
pos = metadata.rfind('.');
|
||||
metadata = metadata.substr(pos + 1);
|
||||
|
||||
if (metadata.compare(PLATFORM) == 0) {
|
||||
has_metadata = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_metadata) {
|
||||
ERROR("%s does not contain any meta-data for this platform\n", linkfile);
|
||||
opk_close(pdata);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
opkFile = file;
|
||||
pos = file.rfind('/');
|
||||
opkMount = file.substr(pos+1);
|
||||
|
Loading…
Reference in New Issue
Block a user