1
0
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
Lakka-rk322x/packages/mediacenter/kodi/patches/kodi-100.05-make-binary-addons-executable.patch
2021-01-30 14:45:52 +01:00

55 lines
1.5 KiB
Diff

From 3e1f7d098726e4af7eac9c83c70cf8196e4e9e3e Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Wed, 5 Jul 2017 15:46:51 +0100
Subject: [PATCH] make binary addons executable
add executable mode to all files in addon's bin folder
credits to vpeter4 for the patch
---
xbmc/addons/Addon.cpp | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
--- a/xbmc/addons/Addon.cpp
+++ b/xbmc/addons/Addon.cpp
@@ -14,6 +14,10 @@
#include <utility>
#include <vector>
+#include <iostream>
+#include <dirent.h>
+#include <sys/stat.h>
+
#include "AddonManager.h"
#include "addons/settings/AddonSettings.h"
#include "filesystem/Directory.h"
@@ -385,6 +389,28 @@ void OnPreInstall(const AddonPtr& addon)
void OnPostInstall(const AddonPtr& addon, bool update, bool modal)
{
+ // OE: make binary addons executable, creddits to vpeter4
+ std::string addonDirPath;
+ std::string chmodFilePath;
+ DIR *addonsDir;
+ struct dirent *fileDirent;
+ struct stat fileStat;
+ int statRet;
+
+ addonDirPath = "/storage/.kodi/addons/" + addon->ID() + "/bin/";
+ if ((addonsDir = opendir(addonDirPath.c_str())) != NULL)
+ {
+ while ((fileDirent = readdir(addonsDir)) != NULL)
+ {
+ chmodFilePath = addonDirPath + fileDirent->d_name;
+ statRet = stat(chmodFilePath.c_str(), &fileStat);
+ if (statRet == 0 && (fileStat.st_mode & S_IFMT) != S_IFDIR)
+ chmod(chmodFilePath.c_str(), fileStat.st_mode | S_IXUSR | S_IXGRP | S_IXOTH);
+ }
+ closedir(addonsDir);
+ }
+ // OE
+
addon->OnPostInstall(update, modal);
}