Commit f20bca4c authored by Benjamin REIS's avatar Benjamin REIS
Browse files

fix getDataPath on iOS

parent 9c291ba2
......@@ -207,7 +207,7 @@ if(ENABLE_STATIC)
add_dependencies(linphone-static liblinphone-git-version)
target_include_directories(linphone-static PUBLIC ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone-static INTERFACE ${LIBS})
if(IOS)
if(APPLE)
target_link_libraries(linphone-static INTERFACE "-framework Foundation" "-framework AVFoundation")
endif()
install(TARGETS linphone-static EXPORT ${EXPORT_TARGETS_NAME}Targets
......@@ -248,6 +248,9 @@ if(ENABLE_SHARED)
add_dependencies(linphone liblinphone-git-version)
target_include_directories(linphone PUBLIC ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone PRIVATE ${LIBS})
if(APPLE)
target_link_libraries(linphone PRIVATE "-framework Foundation" "-framework AVFoundation")
endif()
if(WIN32 AND CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(linphone PROPERTIES PREFIX "lib")
elseif(ANDROID)
......
......@@ -251,7 +251,7 @@ endforeach ()
set(LINPHONE_PRIVATE_HEADER_FILES ${LINPHONE_PRIVATE_HEADER_FILES} PARENT_SCOPE)
bc_apply_compile_flags(LINPHONE_CXX_OBJECTS_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
bc_apply_compile_flags(LINPHONE_OBJC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX STRICT_OPTIONS_OBJC)
bc_apply_compile_flags(LINPHONE_OBJC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
if (ENABLE_STATIC)
add_library(
......
......@@ -105,7 +105,7 @@ Core::Core (LinphoneCore *cCore) : Object(*new CorePrivate) {
: MainDb::Sqlite3;
else {
backend = AbstractDb::Sqlite3;
uri = getDataPath() + "/" LINPHONE_DB;
uri = getDataPath() + LINPHONE_DB;
}
lInfo() << "Opening " LINPHONE_DB " at: " << uri;
......
/*
* paths-apple.m
* paths-apple.mm
* Copyright (C) 2010-2017 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
......@@ -19,37 +19,29 @@
#import "linphone/utils/utils.h"
#include "core/platform-helpers/platform-helpers.h"
#import "core/platform-helpers/platform-helpers.h"
#import "paths-apple.h"
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
std::string SysPaths::getDataPath (PlatformHelpers *platformHelper) {
#ifdef __OBJC__
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *writablePath = [paths objectAtIndex:0];
NSString *fullPath = [writablePath stringByAppendingString:@"/linphone/"];
const char *ret = fullPath.UTF8String;
return ret;
#endif
return Utils::getEmptyConstRefObject<std::string>();
}
std::string SysPaths::getConfigPath (PlatformHelpers *platformHelper) {
#ifdef __OBJC__
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *configPath = [paths objectAtIndex:0];
NSString *fullPath = [configPath stringByAppendingString:@"/Preferences/linphone/"];
const char *ret = fullPath.UTF8String;
return ret;
#endif
return Utils::getEmptyConstRefObject<std::string>();
}
LINPHONE_END_NAMESPACE
......@@ -42,12 +42,12 @@ static string getBaseDirectory () {
}
string SysPaths::getDataPath (PlatformHelpers *platformHelper) {
static string dataPath = getBaseDirectory() + "/.local/share/linphone";
static string dataPath = getBaseDirectory() + "/.local/share/linphone/";
return dataPath;
}
string SysPaths::getConfigPath (PlatformHelpers *platformHelper) {
static string configPath = getBaseDirectory() + "/.config/linphone";
static string configPath = getBaseDirectory() + "/.config/linphone/";
return configPath;
}
......
......@@ -38,7 +38,7 @@ string SysPaths::getDataPath (PlatformHelpers *platformHelper) {
// Get path for each computer, non-user specific and non-roaming data.
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath))) {
stringstream path;
path << boost::lexical_cast<std::string>(szPath) << "/linphone";
path << boost::lexical_cast<std::string>(szPath) << "\\linphone\\";
string ret = path.str();
boost::replace_all(ret, "\\", "\\\\");
return ret;
......
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