From 51868d5201dc319c4c65b9f8a1d142be9040b57c Mon Sep 17 00:00:00 2001
From: Pawel Andruszkiewicz
Date: Wed, 3 Jun 2015 11:31:17 +0200
Subject: [PATCH] [SystemInfo] Removed hard coded paths.
[Verification] Code compiles.
Change-Id: Ied6892ca61f8457555a696ddda0f855d0cb79b10
Signed-off-by: Pawel Andruszkiewicz
---
src/systeminfo/systeminfo-utils.cpp | 9 +++++----
src/systeminfo/systeminfo.gyp | 1 +
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/systeminfo/systeminfo-utils.cpp b/src/systeminfo/systeminfo-utils.cpp
index efea9a61..8f1f2534 100644
--- a/src/systeminfo/systeminfo-utils.cpp
+++ b/src/systeminfo/systeminfo-utils.cpp
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include "common/logger.h"
#include "common/platform_exception.h"
@@ -144,8 +145,8 @@ const std::string kOrientationLandscapeSecondary = "LANDSCAPE_SECONDARY";
//Peripheral
const std::string kVideoOutputString = "isVideoOutputOn";
//Storage
-const char* kStorageInternalPath = "/opt/usr/media";
-const char* kStorageSdcardPath = "/opt/storage/sdcard";
+const std::string kStorageInternalPath = tzplatform_getenv(TZ_USER_CONTENT);
+const std::string kStorageSdcardPath = std::string(tzplatform_getenv(TZ_SYS_STORAGE)) + "/sdcard";
const std::string kPropertyIdStorage = "STORAGE";
const std::string kTypeUnknown = "UNKNOWN";
const std::string kTypeInternal = "INTERNAL";
@@ -2466,7 +2467,7 @@ PlatformResult SysteminfoUtils::ReportStorage(picojson::object& out) {
array.push_back(picojson::value(picojson::object()));
picojson::object& internal_obj = array.back().get();
- if (statfs(kStorageInternalPath, &fs) < 0) {
+ if (statfs(kStorageInternalPath.c_str(), &fs) < 0) {
LoggerE("There are no storage units detected");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "There are no storage units detected");
}
@@ -2475,7 +2476,7 @@ PlatformResult SysteminfoUtils::ReportStorage(picojson::object& out) {
if (0 == vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdcardState)) {
if (VCONFKEY_SYSMAN_MMC_MOUNTED == sdcardState){
- if (statfs(kStorageSdcardPath, &fs) < 0) {
+ if (statfs(kStorageSdcardPath.c_str(), &fs) < 0) {
LoggerE("MMC mounted, but not accessible");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "MMC mounted, but not accessible");
}
diff --git a/src/systeminfo/systeminfo.gyp b/src/systeminfo/systeminfo.gyp
index 9137bd95..d07276f1 100644
--- a/src/systeminfo/systeminfo.gyp
+++ b/src/systeminfo/systeminfo.gyp
@@ -37,6 +37,7 @@
'capi-network-wifi',
'tapi',
'sensor',
+ 'libtzplatform-config',
]
},
}],
--
2.34.1