Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
8b51263c
Commit
8b51263c
authored
Oct 19, 2017
by
Benjamin REIS
Browse files
pass platformHelper to Paths functions
parent
ddf3fe65
Changes
11
Hide whitespace changes
Inline
Side-by-side
include/linphone/utils/paths.h
View file @
8b51263c
...
...
@@ -28,13 +28,14 @@
LINPHONE_BEGIN_NAMESPACE
class
PlatformHelper
;
namespace
Paths
{
enum
Type
{
Data
,
Config
};
LINPHONE_PUBLIC
const
std
::
string
&
getPath
(
Type
type
,
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getPath
(
Type
type
,
PlatformHelper
*
platformHelper
);
}
LINPHONE_END_NAMESPACE
...
...
src/core/core.cpp
View file @
8b51263c
...
...
@@ -24,8 +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 "private.h"
#include "core.h"
// =============================================================================
...
...
@@ -47,8 +50,8 @@ Core::Core (LinphoneCore *cCore) : Object(*new CorePrivate) {
:
MainDb
::
Sqlite3
;
d
->
mainDb
.
connect
(
backend
,
uri
);
}
else
{
// TODO
//
d->mainDb.connect(MainDb::Sqlite3, linphone_factory_get_writable_dir()/linphone.db);
string
path
=
Paths
::
getPath
(
Paths
::
Data
,
static_cast
<
PlatformHelper
*>
(
cCore
->
platform_helper
));
//d->mainDb.connect(MainDb::Sqlite3, linphone_factory_get_writable_dir()/linphone.db);
}
}
...
...
src/utils/paths/paths-android.cpp
View file @
8b51263c
...
...
@@ -19,6 +19,7 @@
#include <jni.h>
#include "private.h"
#include "linphone/utils/utils.h"
#include "paths-android.h"
...
...
@@ -28,13 +29,21 @@
LINPHONE_BEGIN_NAMESPACE
const
std
::
string
&
SysPaths
::
getDataPath
(
void
*
context
)
{
//TODO.
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
if
(
!
context
)
{
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
}
AndroidPlatformHelper
*
helper
=
static_cast
<
AndroidPlatformHelper
>
(
context
);
return
helper
->
getDataPath
();
}
const
std
::
string
&
SysPaths
::
getConfigPath
(
void
*
context
)
{
//TODO.
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
if
(
!
context
)
{
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
}
AndroidPlatformHelper
*
helper
=
static_cast
<
AndroidPlatformHelper
>
(
context
);
return
helper
->
getConfigPath
();
}
LINPHONE_END_NAMESPACE
src/utils/paths/paths-android.h
View file @
8b51263c
...
...
@@ -28,9 +28,10 @@
LINPHONE_BEGIN_NAMESPACE
class
PlatformHelper
;
namespace
SysPaths
{
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
PlatformHelper
*
platformHelper
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
PlatformHelper
*
platformHelper
);
}
LINPHONE_END_NAMESPACE
...
...
src/utils/paths/paths-apple.h
View file @
8b51263c
...
...
@@ -28,9 +28,10 @@
LINPHONE_BEGIN_NAMESPACE
class
PlatformHelper
;
namespace
SysPaths
{
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
PlatformHelper
*
platformHelper
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
PlatformHelper
*
platformHelper
);
}
LINPHONE_END_NAMESPACE
...
...
src/utils/paths/paths-apple.mm
View file @
8b51263c
...
...
@@ -19,6 +19,7 @@
#import "linphone/utils/utils.h"
#include "private.h"
#import "paths-apple.h"
#ifdef __OBJC__
...
...
@@ -29,7 +30,7 @@
LINPHONE_BEGIN_NAMESPACE
const
std
::
string
&
SysPaths
::
getDataPath
(
void
*
context
)
{
const
std
::
string
&
SysPaths
::
getDataPath
(
PlatformHelper
*
platformHelper
)
{
#ifdef __OBJC__
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSApplicationSupportDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
writablePath
=
[
paths
objectAtIndex
:
0
];
...
...
@@ -40,7 +41,7 @@ const std::string &SysPaths::getDataPath (void *context) {
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
}
const
std
::
string
&
SysPaths
::
getConfigPath
(
void
*
context
)
{
const
std
::
string
&
SysPaths
::
getConfigPath
(
PlatformHelper
*
platformHelper
)
{
#ifdef __OBJC__
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSLibraryDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
configPath
=
[
paths
objectAtIndex
:
0
];
...
...
src/utils/paths/paths-linux.cpp
View file @
8b51263c
...
...
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "private.h"
#include "linphone/utils/utils.h"
#include "paths-linux.h"
...
...
@@ -25,12 +26,12 @@
LINPHONE_BEGIN_NAMESPACE
const
std
::
string
&
SysPaths
::
getDataPath
(
void
*
context
)
{
const
std
::
string
&
SysPaths
::
getDataPath
(
PlatformHelper
*
platformHelper
)
{
//TODO.
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
}
const
std
::
string
&
SysPaths
::
getConfigPath
(
void
*
context
)
{
const
std
::
string
&
SysPaths
::
getConfigPath
(
PlatformHelper
*
platformHelper
)
{
//TODO.
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
}
...
...
src/utils/paths/paths-linux.h
View file @
8b51263c
...
...
@@ -28,9 +28,10 @@
LINPHONE_BEGIN_NAMESPACE
class
PlatformHelper
;
namespace
SysPaths
{
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
PlatformHelper
*
platformHelper
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
PlatformHelper
*
platformHelper
);
}
LINPHONE_END_NAMESPACE
...
...
src/utils/paths/paths-windows.cpp
View file @
8b51263c
...
...
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "private.h"
#include "linphone/utils/utils.h"
#include "paths-windows.h"
...
...
@@ -25,12 +26,12 @@
LINPHONE_BEGIN_NAMESPACE
const
std
::
string
&
SysPaths
::
getDataPath
(
void
*
context
)
{
const
std
::
string
&
SysPaths
::
getDataPath
(
PlatformHelper
*
platformHelper
)
{
//TODO.
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
}
const
std
::
string
&
SysPaths
::
getConfigPath
(
void
*
context
)
{
const
std
::
string
&
SysPaths
::
getConfigPath
(
PlatformHelper
*
platformHelper
)
{
//TODO.
return
Utils
::
getEmptyConstRefObject
<
std
::
string
>
();
}
...
...
src/utils/paths/paths-windows.h
View file @
8b51263c
...
...
@@ -28,9 +28,10 @@
LINPHONE_BEGIN_NAMESPACE
class
PlatformHelper
;
namespace
SysPaths
{
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
void
*
context
);
LINPHONE_PUBLIC
const
std
::
string
&
getDataPath
(
PlatformHelper
*
platformHelper
);
LINPHONE_PUBLIC
const
std
::
string
&
getConfigPath
(
PlatformHelper
*
platformHelper
);
}
LINPHONE_END_NAMESPACE
...
...
src/utils/paths/paths.cpp
View file @
8b51263c
...
...
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "private.h"
#include "linphone/utils/paths.h"
#ifdef __APPLE__
...
...
@@ -37,13 +38,13 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
const
string
&
Paths
::
getPath
(
Paths
::
Type
type
,
void
*
context
)
{
const
string
&
Paths
::
getPath
(
Paths
::
Type
type
,
PlatformHelper
*
platformHelper
)
{
switch
(
type
)
{
case
Data
:
return
SysPaths
::
getDataPath
(
context
);
return
SysPaths
::
getDataPath
(
platformHelper
);
case
Config
:
default:
return
SysPaths
::
getConfigPath
(
context
);
return
SysPaths
::
getConfigPath
(
platformHelper
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment