mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
add getDataPath and getconfigPath for iOS
This commit is contained in:
parent
a44cbae88d
commit
079cfcfb44
16 changed files with 455 additions and 5 deletions
|
|
@ -2234,7 +2234,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
lc->sal->set_user_pointer(lc);
|
||||
lc->sal->set_callbacks(&linphone_sal_callbacks);
|
||||
|
||||
new(&lc->cppCore) Core();
|
||||
new(&lc->cppCore) Core(lc);
|
||||
|
||||
#ifdef TUNNEL_ENABLED
|
||||
lc->tunnel=linphone_core_tunnel_new(lc);
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ set(UTILS_HEADER_FILES
|
|||
enum-generator.h
|
||||
general.h
|
||||
magic-macros.h
|
||||
paths.h
|
||||
utils.h
|
||||
)
|
||||
|
||||
|
|
|
|||
42
include/linphone/utils/paths.h
Normal file
42
include/linphone/utils/paths.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* paths.h
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PATHS_H_
|
||||
#define _PATHS_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
namespace Paths {
|
||||
enum Type {
|
||||
Data,
|
||||
Config
|
||||
};
|
||||
|
||||
LINPHONE_PUBLIC const std::string &getPath(Type type, void *context);
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _PATHS_H_
|
||||
|
|
@ -199,6 +199,7 @@ 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
|
||||
|
|
@ -207,6 +208,27 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
xml/xml.cpp
|
||||
)
|
||||
|
||||
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)
|
||||
endif()
|
||||
|
||||
if (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)
|
||||
endif()
|
||||
|
||||
if (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)
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
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)
|
||||
endif()
|
||||
|
||||
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS} ${LIBXSD_INCLUDE_DIRS})
|
||||
set(LINPHONE_CXX_OBJECTS_DEFINITIONS "-DLIBLINPHONE_EXPORTS")
|
||||
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS})
|
||||
|
|
@ -223,11 +245,12 @@ 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)
|
||||
|
||||
if(ENABLE_STATIC)
|
||||
add_library(
|
||||
linphone-cxx-objects-static OBJECT
|
||||
${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES}
|
||||
${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
|
||||
)
|
||||
target_compile_definitions(linphone-cxx-objects-static PRIVATE ${LINPHONE_CXX_OBJECTS_DEFINITIONS})
|
||||
target_include_directories(linphone-cxx-objects-static SYSTEM PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS} ${LINPHONE_INCLUDE_DIRS})
|
||||
|
|
@ -236,7 +259,7 @@ endif()
|
|||
if(ENABLE_SHARED)
|
||||
add_library(
|
||||
linphone-cxx-objects OBJECT
|
||||
${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES}
|
||||
${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
|
||||
)
|
||||
target_compile_definitions(linphone-cxx-objects PRIVATE ${LINPHONE_CXX_OBJECTS_DEFINITIONS})
|
||||
target_include_directories(linphone-cxx-objects SYSTEM PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS} ${LINPHONE_INCLUDE_DIRS})
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
class CorePrivate : public ObjectPrivate {
|
||||
public:
|
||||
MainDb mainDb;
|
||||
LinphoneCore *cCore;
|
||||
|
||||
private:
|
||||
std::list<std::shared_ptr<ChatRoom>> chatRooms;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "chat/chat-room/basic-chat-room.h"
|
||||
#include "core-p.h"
|
||||
#include "db/main-db.h"
|
||||
#include "linphone/core.h"
|
||||
#include "object/object-p.h"
|
||||
|
||||
#include "core.h"
|
||||
|
|
@ -35,7 +36,21 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Core::Core () : Object(*new CorePrivate) {}
|
||||
Core::Core (LinphoneCore *cCore) : Object(*new CorePrivate) {
|
||||
L_D();
|
||||
d->cCore = cCore;
|
||||
const char *uri = lp_config_get_string(linphone_core_get_config(d->cCore), "server", "db_uri", NULL);
|
||||
if (uri) {
|
||||
AbstractDb::Backend backend =
|
||||
strcmp(lp_config_get_string(linphone_core_get_config(d->cCore), "server", "db_backend", NULL), "mysql") == 0
|
||||
? MainDb::Mysql
|
||||
: MainDb::Sqlite3;
|
||||
d->mainDb.connect(backend, uri);
|
||||
} else {
|
||||
// TODO
|
||||
// d->mainDb.connect(MainDb::Sqlite3, linphone_factory_get_writable_dir()/linphone.db);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CorePrivate;
|
|||
class LINPHONE_PUBLIC Core : public Object {
|
||||
friend class ClientGroupChatRoom;
|
||||
public:
|
||||
Core ();
|
||||
Core (LinphoneCore *cCore);
|
||||
|
||||
std::shared_ptr<ChatRoom> createClientGroupChatRoom (const std::string &subject);
|
||||
std::shared_ptr<ChatRoom> getOrCreateChatRoom (const std::string &peerAddress, bool isRtt = false) const;
|
||||
|
|
|
|||
38
src/utils/paths/paths-android.cpp
Normal file
38
src/utils/paths/paths-android.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* paths-android.cpp
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "paths-android.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
const std::string &SysPaths::getDataPath (void *context) {
|
||||
//TODO.
|
||||
return Utils::getEmptyConstRefObject<std::string>();
|
||||
}
|
||||
|
||||
const std::string &SysPaths::getConfigPath (void *context) {
|
||||
//TODO.
|
||||
return Utils::getEmptyConstRefObject<std::string>();
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
38
src/utils/paths/paths-android.h
Normal file
38
src/utils/paths/paths-android.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* paths-android.h
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PATHS_ANDROID_H_
|
||||
#define _PATHS_ANDROID_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
namespace SysPaths {
|
||||
LINPHONE_PUBLIC const std::string &getDataPath (void *context);
|
||||
LINPHONE_PUBLIC const std::string &getConfigPath (void *context);
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _PATHS_ANDROID_H_
|
||||
38
src/utils/paths/paths-apple.h
Normal file
38
src/utils/paths/paths-apple.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* paths-apple.h
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PATHS_APPLE_H_
|
||||
#define _PATHS_APPLE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
namespace SysPaths {
|
||||
LINPHONE_PUBLIC const std::string &getDataPath (void *context);
|
||||
LINPHONE_PUBLIC const std::string &getConfigPath (void *context);
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _PATHS_APPLE_H_
|
||||
54
src/utils/paths/paths-apple.mm
Normal file
54
src/utils/paths/paths-apple.mm
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* paths-apple.m
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#import "linphone/utils/utils.h"
|
||||
|
||||
#import "paths-apple.h"
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
const std::string &SysPaths::getDataPath (void *context) {
|
||||
#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>();
|
||||
}
|
||||
|
||||
const std::string &SysPaths::getConfigPath (void *context) {
|
||||
#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
|
||||
38
src/utils/paths/paths-linux.cpp
Normal file
38
src/utils/paths/paths-linux.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* paths-linux.cpp
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "paths-linux.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
const std::string &SysPaths::getDataPath (void *context) {
|
||||
//TODO.
|
||||
return Utils::getEmptyConstRefObject<std::string>();
|
||||
}
|
||||
|
||||
const std::string &SysPaths::getConfigPath (void *context) {
|
||||
//TODO.
|
||||
return Utils::getEmptyConstRefObject<std::string>();
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
38
src/utils/paths/paths-linux.h
Normal file
38
src/utils/paths/paths-linux.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* paths-linux.h
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PATHS_LINUX_H_
|
||||
#define _PATHS_LINUX_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
namespace SysPaths {
|
||||
LINPHONE_PUBLIC const std::string &getDataPath (void *context);
|
||||
LINPHONE_PUBLIC const std::string &getConfigPath (void *context);
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _PATHS_LINUX_H_
|
||||
38
src/utils/paths/paths-windows.cpp
Normal file
38
src/utils/paths/paths-windows.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* paths-windows.cpp
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "paths-windows.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
const std::string &SysPaths::getDataPath (void *context) {
|
||||
//TODO.
|
||||
return Utils::getEmptyConstRefObject<std::string>();
|
||||
}
|
||||
|
||||
const std::string &SysPaths::getConfigPath (void *context) {
|
||||
//TODO.
|
||||
return Utils::getEmptyConstRefObject<std::string>();
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
38
src/utils/paths/paths-windows.h
Normal file
38
src/utils/paths/paths-windows.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* paths-windws.h
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PATHS_WINDOWS_H_
|
||||
#define _PATHS_WINDOWS_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
namespace SysPaths {
|
||||
LINPHONE_PUBLIC const std::string &getDataPath (void *context);
|
||||
LINPHONE_PUBLIC const std::string &getConfigPath (void *context);
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _PATHS_WINDOWS_H_
|
||||
48
src/utils/paths/paths.cpp
Normal file
48
src/utils/paths/paths.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* utils.cpp
|
||||
* Copyright (C) 2010-2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "linphone/utils/paths.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "paths-apple.h"
|
||||
#elif defined(__ANDROID__)
|
||||
#include "paths-android.h"
|
||||
#elif defined(_WIN32)
|
||||
#include "paths-windows.h"
|
||||
#elif defined(__linux)
|
||||
#include "paths-linux.h"
|
||||
#else
|
||||
#error "Unsupported system"
|
||||
#endif
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
const string &Paths::getPath (Paths::Type type, void *context) {
|
||||
switch (type) {
|
||||
case Data:
|
||||
return SysPaths::getDataPath(context);
|
||||
case Config:
|
||||
return SysPaths::getConfigPath(context);
|
||||
}
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
Loading…
Add table
Reference in a new issue