Commit eea08e3e authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

ringtone: do not save full path

Since on iOS app have different path each time when starts, ringtone
paths also must be updated. But when playing ringtone we all time could
have current application direction, so we could just save relative
constant path.

Change-Id: I738e5bd26d036b11201a8b2a83bb22126d3139e4
parent bcdb5140
......@@ -87,6 +87,10 @@ using random_device = dht::crypto::random_device;
#include <sys/resource.h>
#endif
#ifdef TARGET_OS_IOS
#include <CoreFoundation/CoreFoundation.h>
#endif
#include <cerrno>
#include <ctime>
#include <cstdlib>
......@@ -2145,15 +2149,23 @@ Manager::playRingtone(const std::string& accountID)
}
std::string ringchoice = account->getRingtonePath();
#ifndef _WIN32
#ifdef TARGET_OS_IOS
//for ios file located in main buindle
CFBundleRef bundle = CFBundleGetMainBundle();
CFURLRef bundleURL = CFBundleCopyBundleURL(bundle);
CFStringRef stringPath = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
const char *buindlePath = CFStringGetCStringPtr(stringPath, encodingMethod);
ringchoice = std::string(buindlePath) + DIR_SEPARATOR_STR + ringchoice;
#elif _WIN32
ringchoice = decodeMultibyteString(ringchoice);
#else
if (ringchoice.find(DIR_SEPARATOR_CH) == std::string::npos) {
// check inside global share directory
static const char * const RINGDIR = "ringtones";
ringchoice = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR
+ RINGDIR + DIR_SEPARATOR_STR + ringchoice;
+ RINGDIR + DIR_SEPARATOR_STR + ringchoice;
}
#else
ringchoice = decodeMultibyteString(ringchoice);
#endif
{
......
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