diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 11a8604fc..f0a3bfdd6 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -47,7 +47,6 @@ list(APPEND LINPHONE_PRIVATE_HEADER_FILES sqlite3_bctbx_vfs.h vcard_private.h xml2lpc.h - platform-helpers.h ) set(LINPHONE_SOURCE_FILES_C @@ -111,8 +110,6 @@ set(LINPHONE_SOURCE_FILES_C set(LINPHONE_SOURCE_FILES_CXX conference.cc tester_utils.cpp - platform-helpers.cpp - android-helpers.cpp ) set(LINPHONE_INCLUDE_DIRS ${LINPHONE_INCLUDE_DIRS}) if(ENABLE_JAVA_WRAPPER) diff --git a/coreapi/private.h b/coreapi/private.h index 4cf7346a0..e00100c3f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -42,7 +42,7 @@ #include "sal/register-op.h" #ifdef __cplusplus -#include "platform-helpers.h" +#include "core/platform-helpers/platform-helpers.h" #endif #include "linphone/sipsetup.h" diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 18579565f..31f1c52d6 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -100,7 +100,6 @@ set(UTILS_HEADER_FILES enum-generator.h general.h magic-macros.h - paths.h utils.h ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc07f9dab..3dcdcfb6c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,6 +81,8 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES content/content.h core/core-p.h core/core.h + core/paths/paths.h + core/platform-helpers/platform-helpers.h db/abstract/abstract-db-p.h db/abstract/abstract-db.h db/main-db-p.h @@ -169,6 +171,8 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES content/content-type.cpp content/content.cpp core/core.cpp + core/paths/paths.cpp + core/platform-helpers/platform-helpers.cpp db/abstract/abstract-db.cpp db/main-db.cpp db/session/db-session-provider.cpp @@ -199,7 +203,6 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES sal/register-op.cpp sal/sal.cpp utils/general.cpp - utils/paths/paths.cpp utils/payload-type-handler.cpp utils/utils.cpp variant/variant.cpp @@ -210,20 +213,20 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES set(LINPHONE_OBJC_SOURCE_FILES) if (APPLE) - list(APPEND LINPHONE_OBJC_SOURCE_FILES utils/paths/paths-apple.mm) - list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES utils/paths/paths-apple.h) + list(APPEND LINPHONE_OBJC_SOURCE_FILES core/paths/paths-apple.mm) + list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-apple.h) elseif(ANDROID) - list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES utils/paths/paths-android.cpp) - list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES utils/paths/paths-android.h) + list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-android.cpp core/platform-helpers/android-helpers.cpp) + list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-android.h) elseif(WIN32) - list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES utils/paths/paths-windows.cpp) - list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES utils/paths/paths-windows.h) + list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-windows.cpp) + list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-windows.h) elseif(UNIX) - list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES utils/paths/paths-linux.cpp) - list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES utils/paths/paths-linux.h) + list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-linux.cpp) + list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-linux.h) endif() set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS} ${LIBXSD_INCLUDE_DIRS}) diff --git a/src/core/core.cpp b/src/core/core.cpp index bf9dfa3c0..27fcd0e32 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -24,13 +24,11 @@ #include "core-p.h" #include "db/main-db.h" #include "linphone/core.h" -#include "linphone/utils/paths.h" #include "object/object-p.h" +#include "paths/paths.h" #include "private.h" -#include "core.h" - // ============================================================================= using namespace std; @@ -50,7 +48,7 @@ Core::Core (LinphoneCore *cCore) : Object(*new CorePrivate) { : MainDb::Sqlite3; d->mainDb.connect(backend, uri); } else { - string path = Paths::getPath(Paths::Data, static_cast(cCore->platform_helper)); + string path = getDataPath(); //d->mainDb.connect(MainDb::Sqlite3, linphone_factory_get_writable_dir()/linphone.db); } } @@ -71,6 +69,16 @@ const list> &Core::getChatRooms () const { return d->chatRooms; } +const std::string &Core::getDataPath() const { + L_D(); + return Paths::getPath(Paths::Data, static_cast(d->cCore->platform_helper)); +} + +const std::string &Core::getConfigPath() const { + L_D(); + return Paths::getPath(Paths::Config, static_cast(d->cCore->platform_helper)); +} + // ----------------------------------------------------------------------------- LINPHONE_END_NAMESPACE diff --git a/src/core/core.h b/src/core/core.h index a23b79f52..6a6086989 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -39,6 +39,8 @@ public: std::shared_ptr createClientGroupChatRoom (const std::string &subject); std::shared_ptr getOrCreateChatRoom (const std::string &peerAddress, bool isRtt = false) const; const std::list> &getChatRooms () const; + const std::string &getDataPath() const; + const std::string &getConfigPath() const; private: L_DECLARE_PRIVATE(Core); diff --git a/src/utils/paths/paths-android.cpp b/src/core/paths/paths-android.cpp similarity index 96% rename from src/utils/paths/paths-android.cpp rename to src/core/paths/paths-android.cpp index cf846471e..52ac08424 100644 --- a/src/utils/paths/paths-android.cpp +++ b/src/core/paths/paths-android.cpp @@ -19,7 +19,7 @@ #include -#include "private.h" +#include "core/platform-helpers/platform-helpers.h" #include "linphone/utils/utils.h" #include "paths-android.h" diff --git a/src/utils/paths/paths-android.h b/src/core/paths/paths-android.h similarity index 100% rename from src/utils/paths/paths-android.h rename to src/core/paths/paths-android.h diff --git a/src/utils/paths/paths-apple.h b/src/core/paths/paths-apple.h similarity index 100% rename from src/utils/paths/paths-apple.h rename to src/core/paths/paths-apple.h diff --git a/src/utils/paths/paths-apple.mm b/src/core/paths/paths-apple.mm similarity index 97% rename from src/utils/paths/paths-apple.mm rename to src/core/paths/paths-apple.mm index 62be4965f..6b13317a4 100644 --- a/src/utils/paths/paths-apple.mm +++ b/src/core/paths/paths-apple.mm @@ -19,7 +19,7 @@ #import "linphone/utils/utils.h" -#include "private.h" +#include "core/platform-helpers/platform-helpers.h" #import "paths-apple.h" #ifdef __OBJC__ diff --git a/src/utils/paths/paths-linux.cpp b/src/core/paths/paths-linux.cpp similarity index 96% rename from src/utils/paths/paths-linux.cpp rename to src/core/paths/paths-linux.cpp index 9e79c8d6f..b52bc05ff 100644 --- a/src/utils/paths/paths-linux.cpp +++ b/src/core/paths/paths-linux.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "private.h" +#include "core/platform-helpers/platform-helpers.h" #include "linphone/utils/utils.h" #include "paths-linux.h" diff --git a/src/utils/paths/paths-linux.h b/src/core/paths/paths-linux.h similarity index 100% rename from src/utils/paths/paths-linux.h rename to src/core/paths/paths-linux.h diff --git a/src/utils/paths/paths-windows.cpp b/src/core/paths/paths-windows.cpp similarity index 96% rename from src/utils/paths/paths-windows.cpp rename to src/core/paths/paths-windows.cpp index 9ad20b968..85d75c7be 100644 --- a/src/utils/paths/paths-windows.cpp +++ b/src/core/paths/paths-windows.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "private.h" +#include "core/platform-helpers/platform-helpers.h" #include "linphone/utils/utils.h" #include "paths-windows.h" diff --git a/src/utils/paths/paths-windows.h b/src/core/paths/paths-windows.h similarity index 100% rename from src/utils/paths/paths-windows.h rename to src/core/paths/paths-windows.h diff --git a/src/utils/paths/paths.cpp b/src/core/paths/paths.cpp similarity index 95% rename from src/utils/paths/paths.cpp rename to src/core/paths/paths.cpp index 16e652547..f8c0be1f4 100644 --- a/src/utils/paths/paths.cpp +++ b/src/core/paths/paths.cpp @@ -17,8 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "private.h" -#include "linphone/utils/paths.h" +#include "core/platform-helpers/platform-helpers.h" +#include "paths.h" #ifdef __APPLE__ #include "paths-apple.h" diff --git a/include/linphone/utils/paths.h b/src/core/paths/paths.h similarity index 100% rename from include/linphone/utils/paths.h rename to src/core/paths/paths.h diff --git a/coreapi/android-helpers.cpp b/src/core/platform-helpers/android-helpers.cpp similarity index 99% rename from coreapi/android-helpers.cpp rename to src/core/platform-helpers/android-helpers.cpp index afc4e2937..5b2812009 100644 --- a/coreapi/android-helpers.cpp +++ b/src/core/platform-helpers/android-helpers.cpp @@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "linphone/utils/utils.h" #include "private.h" -#include "platform-helpers.h" #ifdef __ANDROID__ diff --git a/coreapi/platform-helpers.cpp b/src/core/platform-helpers/platform-helpers.cpp similarity index 100% rename from coreapi/platform-helpers.cpp rename to src/core/platform-helpers/platform-helpers.cpp diff --git a/coreapi/platform-helpers.h b/src/core/platform-helpers/platform-helpers.h similarity index 98% rename from coreapi/platform-helpers.h rename to src/core/platform-helpers/platform-helpers.h index 3302a17a5..0c689a29e 100644 --- a/coreapi/platform-helpers.h +++ b/src/core/platform-helpers/platform-helpers.h @@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef platform_helpers_h #define platform_helpers_h +#include + +#include "linphone/core.h" #include "linphone/utils/general.h" LINPHONE_BEGIN_NAMESPACE