diff --git a/src/core/paths/paths-android.cpp b/src/core/paths/paths-android.cpp index 5abf19364..72ffa0bd8 100644 --- a/src/core/paths/paths-android.cpp +++ b/src/core/paths/paths-android.cpp @@ -19,8 +19,6 @@ #include -#include "linphone/utils/utils.h" - #include "core/platform-helpers/platform-helpers.h" #include "paths-android.h" @@ -31,16 +29,16 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -string SysPaths::getDataPath (PlatformHelpers *platformHelper) { - if (!platformHelper) - return Utils::getEmptyConstRefObject(); - return platformHelper->getDataPath(); +string SysPaths::getDataPath (PlatformHelpers *platformHelpers) { + if (!platformHelpers) + return ""; + return platformHelpers->getDataPath(); } -string SysPaths::getConfigPath (PlatformHelpers *platformHelper) { - if (!platformHelper) - return Utils::getEmptyConstRefObject(); - return platformHelper->getConfigPath(); +string SysPaths::getConfigPath (PlatformHelpers *platformHelpers) { + if (!platformHelpers) + return ""; + return platformHelpers->getConfigPath(); } LINPHONE_END_NAMESPACE diff --git a/src/core/paths/paths-android.h b/src/core/paths/paths-android.h index c81010eda..828c5147b 100644 --- a/src/core/paths/paths-android.h +++ b/src/core/paths/paths-android.h @@ -31,8 +31,8 @@ LINPHONE_BEGIN_NAMESPACE class PlatformHelpers; namespace SysPaths { - LINPHONE_PUBLIC std::string getDataPath (PlatformHelpers *platformHelper); - LINPHONE_PUBLIC std::string getConfigPath (PlatformHelpers *platformHelper); + LINPHONE_PUBLIC std::string getDataPath (PlatformHelpers *platformHelpers); + LINPHONE_PUBLIC std::string getConfigPath (PlatformHelpers *platformHelpers); } LINPHONE_END_NAMESPACE diff --git a/src/core/paths/paths-apple.h b/src/core/paths/paths-apple.h index f1e3ffb44..fd1c8f6eb 100644 --- a/src/core/paths/paths-apple.h +++ b/src/core/paths/paths-apple.h @@ -31,8 +31,8 @@ LINPHONE_BEGIN_NAMESPACE class PlatformHelpers; namespace SysPaths { - LINPHONE_PUBLIC std::string getDataPath (PlatformHelpers *platformHelper); - LINPHONE_PUBLIC std::string getConfigPath (PlatformHelpers *platformHelper); + LINPHONE_PUBLIC std::string getDataPath (PlatformHelpers *platformHelpers); + LINPHONE_PUBLIC std::string getConfigPath (PlatformHelpers *platformHelpers); } LINPHONE_END_NAMESPACE diff --git a/src/core/paths/paths-apple.mm b/src/core/paths/paths-apple.mm index 8ed4d52d4..64df20292 100644 --- a/src/core/paths/paths-apple.mm +++ b/src/core/paths/paths-apple.mm @@ -17,54 +17,50 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#import "linphone/utils/utils.h" - -#import "core/platform-helpers/platform-helpers.h" -#import "logger/logger.h" -#import "paths-apple.h" - #import +#import "logger/logger.h" + +#import "paths-apple.h" + // ============================================================================= LINPHONE_BEGIN_NAMESPACE -std::string SysPaths::getDataPath (PlatformHelpers *platformHelper) { +std::string SysPaths::getDataPath (PlatformHelpers *) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); NSString *writablePath = [paths objectAtIndex:0]; NSString *fullPath = [writablePath stringByAppendingString:@"/linphone/"]; - if(![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) { + if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) { NSError *error; lInfo() << "Data path " << fullPath.UTF8String << " does not exist, creating it."; if (![[NSFileManager defaultManager] createDirectoryAtPath:fullPath - withIntermediateDirectories:YES - attributes:nil - error:&error]) { - lError() << "Create data path directory error: " << error.description; + withIntermediateDirectories:YES + attributes:nil + error:&error]) { + lError() << "Create data path directory error: " << error.description; } } - const char *ret = fullPath.UTF8String; - return ret; + return fullPath.UTF8String; } -std::string SysPaths::getConfigPath (PlatformHelpers *platformHelper) { +std::string SysPaths::getConfigPath (PlatformHelpers *) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *configPath = [paths objectAtIndex:0]; NSString *fullPath = [configPath stringByAppendingString:@"/Preferences/linphone/"]; - if(![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) { + if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) { NSError *error; lInfo() << "Config path " << fullPath.UTF8String << " does not exist, creating it."; if (![[NSFileManager defaultManager] createDirectoryAtPath:fullPath - withIntermediateDirectories:YES - attributes:nil - error:&error]) { - lError() << "Create config path directory error: " << error.description; + withIntermediateDirectories:YES + attributes:nil + error:&error]) { + lError() << "Create config path directory error: " << error.description; } } - const char *ret = fullPath.UTF8String; - return ret; + return fullPath.UTF8String; } LINPHONE_END_NAMESPACE diff --git a/src/core/paths/paths-linux.cpp b/src/core/paths/paths-linux.cpp index b0055125c..09bd962b5 100644 --- a/src/core/paths/paths-linux.cpp +++ b/src/core/paths/paths-linux.cpp @@ -17,9 +17,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "linphone/utils/utils.h" - -#include "core/platform-helpers/platform-helpers.h" #include "logger/logger.h" #include "paths-linux.h" @@ -41,12 +38,12 @@ static string getBaseDirectory () { return base; } -string SysPaths::getDataPath (PlatformHelpers *platformHelper) { +string SysPaths::getDataPath (PlatformHelpers *) { static string dataPath = getBaseDirectory() + "/.local/share/linphone/"; return dataPath; } -string SysPaths::getConfigPath (PlatformHelpers *platformHelper) { +string SysPaths::getConfigPath (PlatformHelpers *) { static string configPath = getBaseDirectory() + "/.config/linphone/"; return configPath; } diff --git a/src/core/paths/paths-linux.h b/src/core/paths/paths-linux.h index 1c7a9e3b6..d5bc59977 100644 --- a/src/core/paths/paths-linux.h +++ b/src/core/paths/paths-linux.h @@ -31,8 +31,8 @@ LINPHONE_BEGIN_NAMESPACE class PlatformHelpers; namespace SysPaths { - LINPHONE_PUBLIC std::string getDataPath (PlatformHelpers *platformHelper); - LINPHONE_PUBLIC std::string getConfigPath (PlatformHelpers *platformHelper); + LINPHONE_PUBLIC std::string getDataPath (PlatformHelpers *platformHelpers); + LINPHONE_PUBLIC std::string getConfigPath (PlatformHelpers *platformHelpers); } LINPHONE_END_NAMESPACE diff --git a/src/core/paths/paths.cpp b/src/core/paths/paths.cpp index a2f65d95e..3f5dd2374 100644 --- a/src/core/paths/paths.cpp +++ b/src/core/paths/paths.cpp @@ -38,12 +38,12 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -string Paths::getPath (Paths::Type type, PlatformHelpers *platformHelper) { +string Paths::getPath (Paths::Type type, PlatformHelpers *platformHelpers) { switch (type) { case Data: - return SysPaths::getDataPath(platformHelper); + return SysPaths::getDataPath(platformHelpers); case Config: - return SysPaths::getConfigPath(platformHelper); + return SysPaths::getConfigPath(platformHelpers); } L_ASSERT(false); diff --git a/src/core/paths/paths.h b/src/core/paths/paths.h index 83976401f..f7fdf9b5b 100644 --- a/src/core/paths/paths.h +++ b/src/core/paths/paths.h @@ -35,7 +35,7 @@ namespace Paths { Config }; - LINPHONE_PUBLIC std::string getPath (Type type, PlatformHelpers *platformHelper); + LINPHONE_PUBLIC std::string getPath (Type type, PlatformHelpers *platformHelpers); } LINPHONE_END_NAMESPACE