Commit 065c0198 authored by Benjamin REIS's avatar Benjamin REIS
Browse files

use full path instead of just directory for rootca resource

parent d4676fb9
Pipeline #433 failed with stage
in 0 seconds
...@@ -59,7 +59,8 @@ public: ...@@ -59,7 +59,8 @@ public:
private: private:
void bgTaskTimeout (); void bgTaskTimeout ();
static void sBgTaskTimeout (void *data); static void sBgTaskTimeout (void *data);
static std::string directoryForResource (CFStringRef framework, CFStringRef resource); static string getResourceDirPath (CFStringRef framework, CFStringRef resource);
static string getResourcePath (CFStringRef framework, CFStringRef resource);
long int mCpuLockTaskId; long int mCpuLockTaskId;
int mCpuLockCount; int mCpuLockCount;
...@@ -71,20 +72,20 @@ IosPlatformHelpers::IosPlatformHelpers (LinphoneCore *lc, void *system_context) ...@@ -71,20 +72,20 @@ IosPlatformHelpers::IosPlatformHelpers (LinphoneCore *lc, void *system_context)
mCpuLockCount = 0; mCpuLockCount = 0;
mCpuLockTaskId = 0; mCpuLockTaskId = 0;
string rootCaPath = directoryForResource(CFSTR("org.linphone.linphone"), CFSTR("rootca.pem")); string rootCaPath = getResourcePath(CFSTR("org.linphone.linphone"), CFSTR("rootca.pem"));
if (!rootCaPath.empty()) if (!rootCaPath.empty())
linphone_core_set_root_ca(lc, rootCaPath.c_str()); linphone_core_set_root_ca(lc, rootCaPath.c_str());
else else
lError() << "IosPlatformHelpers did not find rootca.pem resource"; lError() << "IosPlatformHelpers did not find rootca.pem resource";
string cpimPath = directoryForResource(CFSTR("org.linphone.linphone"), CFSTR("cpim_grammar")); string cpimPath = getResourceDirPath(CFSTR("org.linphone.linphone"), CFSTR("cpim_grammar"));
if (!cpimPath.empty()) if (!cpimPath.empty())
belr::GrammarLoader::get().addPath(cpimPath); belr::GrammarLoader::get().addPath(cpimPath);
else else
lError() << "IosPlatformHelpers did not find cpim grammar resource directory..."; lError() << "IosPlatformHelpers did not find cpim grammar resource directory...";
#ifdef VCARD_ENABLED #ifdef VCARD_ENABLED
string vcardPath = directoryForResource(CFSTR("org.linphone.belcard"), CFSTR("vcard_grammar")); string vcardPath = getResourceDirPath(CFSTR("org.linphone.belcard"), CFSTR("vcard_grammar"));
if (!vcardPath.empty()) if (!vcardPath.empty())
belr::GrammarLoader::get().addPath(vcardPath); belr::GrammarLoader::get().addPath(vcardPath);
else else
...@@ -133,7 +134,7 @@ void IosPlatformHelpers::releaseCpuLock () { ...@@ -133,7 +134,7 @@ void IosPlatformHelpers::releaseCpuLock () {
mCpuLockTaskId = 0; mCpuLockTaskId = 0;
} }
string IosPlatformHelpers::directoryForResource (CFStringRef framework, CFStringRef resource) { string IosPlatformHelpers::getResourceDirPath (CFStringRef framework, CFStringRef resource) {
CFBundleRef bundle = CFBundleGetBundleWithIdentifier(framework); CFBundleRef bundle = CFBundleGetBundleWithIdentifier(framework);
CFURLRef resourceUrl = CFBundleCopyResourceURL(bundle, resource, nullptr, nullptr); CFURLRef resourceUrl = CFBundleCopyResourceURL(bundle, resource, nullptr, nullptr);
CFURLRef resourceUrlDirectory = CFURLCreateCopyDeletingLastPathComponent(nullptr, resourceUrl); CFURLRef resourceUrlDirectory = CFURLCreateCopyDeletingLastPathComponent(nullptr, resourceUrl);
...@@ -146,6 +147,12 @@ string IosPlatformHelpers::directoryForResource (CFStringRef framework, CFString ...@@ -146,6 +147,12 @@ string IosPlatformHelpers::directoryForResource (CFStringRef framework, CFString
return path; return path;
} }
string IosPlatformHelpers::getResourcePath (CFStringRef framework, CFStringRef resource) {
CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
string resourceFile(CFStringGetCStringPtr(resource, encodingMethod));
return getResourceDirPath(framework, resource) + "/" + resourceFile;
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
PlatformHelpers *createIosPlatformHelpers (LinphoneCore *lc, void *system_context) { PlatformHelpers *createIosPlatformHelpers (LinphoneCore *lc, void *system_context) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment