Skip to content
Snippets Groups Projects
Commit 6226bca1 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Andreas Traczyk
Browse files

plugins: windows adaptation

This patch fits the plugin's code to windows

Change-Id: I3ef6f581af45cde7ca872d2d91a5a42803d6dcac
parent 381d661a
Branches
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ list (APPEND Source_Files__client ...@@ -10,6 +10,7 @@ list (APPEND Source_Files__client
"${CMAKE_CURRENT_SOURCE_DIR}/ring_signal.h" "${CMAKE_CURRENT_SOURCE_DIR}/ring_signal.h"
"${CMAKE_CURRENT_SOURCE_DIR}/videomanager.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/videomanager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/videomanager.h" "${CMAKE_CURRENT_SOURCE_DIR}/videomanager.h"
"${CMAKE_CURRENT_SOURCE_DIR}/plugin_manager_interface.cpp"
) )
set (Source_Files__client ${Source_Files__client} PARENT_SCOPE) set (Source_Files__client ${Source_Files__client} PARENT_SCOPE)
\ No newline at end of file
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#define mode_t unsigned #define mode_t unsigned
#define DIR_SEPARATOR_STR "\\" // Directory separator string #define DIR_SEPARATOR_STR "\\" // Directory separator string
#define DIR_SEPARATOR_CH '\\' // Directory separator char #define DIR_SEPARATOR_CH '\\' // Directory separator char
#define DIR_SEPARATOR_STR_ESC "\\\\" // Escaped directory separator string #define DIR_SEPARATOR_STR_ESC "//*" // Escaped directory separator string
#endif #endif
namespace jami { namespace jami {
......
...@@ -42,15 +42,25 @@ extern "C" { ...@@ -42,15 +42,25 @@ extern "C" {
#define ABI "armeabi" #define ABI "armeabi"
#endif #endif
#elif defined(__i386__) #elif defined(__i386__)
#if __ANDROID__
#define ABI "x86" #define ABI "x86"
#else
#define ABI "x86-linux-gnu"
#endif
#elif defined(__x86_64__) #elif defined(__x86_64__)
#if __ANDROID__
#define ABI "x86_64" #define ABI "x86_64"
#else
#define ABI "x86_64-linux-gnu"
#endif
#elif defined(__mips64) /* mips64el-* toolchain defines __mips__ too */ #elif defined(__mips64) /* mips64el-* toolchain defines __mips__ too */
#define ABI "mips64" #define ABI "mips64"
#elif defined(__mips__) #elif defined(__mips__)
#define ABI "mips" #define ABI "mips"
#elif defined(__aarch64__) #elif defined(__aarch64__)
#define ABI "arm64-v8a" #define ABI "arm64-v8a"
#elif defined(WIN32)
#define ABI "x64-windows"
#else #else
#define ABI "unknown" #define ABI "unknown"
#endif #endif
...@@ -58,6 +68,14 @@ extern "C" { ...@@ -58,6 +68,14 @@ extern "C" {
#define PLUGIN_ALREADY_INSTALLED 100 /* Plugin already installed with the same version */ #define PLUGIN_ALREADY_INSTALLED 100 /* Plugin already installed with the same version */
#define PLUGIN_OLD_VERSION 200 /* Plugin already installed with a newer version */ #define PLUGIN_OLD_VERSION 200 /* Plugin already installed with a newer version */
#ifdef WIN32
#define LIB_TYPE ".dll"
#define LIB_PREFIX ""
#else
#define LIB_TYPE ".so"
#define LIB_PREFIX "lib"
#endif
namespace jami { namespace jami {
std::map<std::string, std::string> std::map<std::string, std::string>
...@@ -111,7 +129,7 @@ checkManifestValidity(const std::vector<uint8_t>& vec) ...@@ -111,7 +129,7 @@ checkManifestValidity(const std::vector<uint8_t>& vec)
static const std::regex DATA_REGEX("^data" DIR_SEPARATOR_STR_ESC ".+"); static const std::regex DATA_REGEX("^data" DIR_SEPARATOR_STR_ESC ".+");
static const std::regex SO_REGEX("([a-zA-Z0-9]+(?:[_-]?[a-zA-Z0-9]+)*)" DIR_SEPARATOR_STR_ESC static const std::regex SO_REGEX("([a-zA-Z0-9]+(?:[_-]?[a-zA-Z0-9]+)*)" DIR_SEPARATOR_STR_ESC
"([a-zA-Z0-9_-]+\\.(so|dll).*)"); "([a-zA-Z0-9_-]+\\.(so|dll|lib).*)");
std::pair<bool, const std::string> std::pair<bool, const std::string>
uncompressJplFunction(const std::string& relativeFileName) uncompressJplFunction(const std::string& relativeFileName)
...@@ -178,7 +196,7 @@ JamiPluginManager::getPluginDetails(const std::string& rootPath) ...@@ -178,7 +196,7 @@ JamiPluginManager::getPluginDetails(const std::string& rootPath)
std::map<std::string, std::string> details = parseManifestFile(manifestPath(rootPath)); std::map<std::string, std::string> details = parseManifestFile(manifestPath(rootPath));
if (!details.empty()) { if (!details.empty()) {
details["iconPath"] = rootPath + DIR_SEPARATOR_CH + "data" + DIR_SEPARATOR_CH + "icon.png"; details["iconPath"] = rootPath + DIR_SEPARATOR_CH + "data" + DIR_SEPARATOR_CH + "icon.png";
details["soPath"] = rootPath + DIR_SEPARATOR_CH + "lib" + details["name"] + ".so"; details["soPath"] = rootPath + DIR_SEPARATOR_CH + LIB_PREFIX + details["name"] + LIB_TYPE;
detailsIt = pluginDetailsMap_.emplace(rootPath, std::move(details)).first; detailsIt = pluginDetailsMap_.emplace(rootPath, std::move(details)).first;
return detailsIt->second; return detailsIt->second;
} }
...@@ -209,6 +227,8 @@ JamiPluginManager::installPlugin(const std::string& jplPath, bool force) ...@@ -209,6 +227,8 @@ JamiPluginManager::installPlugin(const std::string& jplPath, bool force)
try { try {
auto manifestMap = readPluginManifestFromArchive(jplPath); auto manifestMap = readPluginManifestFromArchive(jplPath);
std::string name = manifestMap["name"]; std::string name = manifestMap["name"];
if (name.empty())
return 0;
std::string version = manifestMap["version"]; std::string version = manifestMap["version"];
const std::string destinationDir {fileutils::get_data_dir() + DIR_SEPARATOR_CH const std::string destinationDir {fileutils::get_data_dir() + DIR_SEPARATOR_CH
+ "plugins" + DIR_SEPARATOR_CH + name}; + "plugins" + DIR_SEPARATOR_CH + name};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment