'-fPIC',
'-fvisibility=hidden',
],
+ 'variables': {
+ 'packages': [
+ 'libtzplatform-config',
+ ],
+ },
},
}
#include <sys/types.h>
#include <sys/stat.h>
+#include <tzplatform_config.h>
#include <unistd.h>
#include "download/download_context.h"
const std::string destination) const {
// TODO(hdq): User should be able to choose store to external storage
// i.e. /opt/storage/sdcard/Downloads
- const std::string directory("/opt/usr/media/");
const std::string default_folder("Downloads");
const std::string location = destination.empty() ? default_folder : destination;
- std::string path = directory + GetActualFolder(location);
+ std::string path = tzplatform_getenv(TZ_USER_CONTENT) + GetActualFolder(location);
// Create path if not exist
struct stat path_stat;
if (stat(path.c_str(), &path_stat) == -1
&& mkdir(path.c_str(), 0777) != 0) {
- path = directory + default_folder;
+ path = tzplatform_getenv(TZ_USER_CONTENT) + default_folder;
}
return path;
#include <pkgmgr-info.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <tzplatform_config.h>
#include <unistd.h>
#include <iostream>
namespace {
const unsigned kDefaultFileMode = 0755;
-const char kDefaultPath[] = "/opt/usr/media";
-const char kPathCamera[] = "/opt/usr/media/Camera";
-const char kPathSounds[] = "/opt/usr/media/Sounds";
-const char kPathImages[] = "/opt/usr/media/Images";
-const char kPathVideos[] = "/opt/usr/media/Videos";
-const char kPathDownloads[] = "/opt/usr/media/Downloads";
-const char kPathDocuments[] = "/opt/usr/media/Documents";
-const char kPathRingtones[] = "/opt/usr/share/settings/Ringtones";
const char kLocationCamera[] = "camera";
const char kLocationMusic[] = "music";
AddInternalStorage(kLocationWgtPrivateTmp, JoinPath(app_path, "tmp"));
}
- AddInternalStorage(kLocationCamera, kPathCamera);
- AddInternalStorage(kLocationMusic, kPathSounds);
- AddInternalStorage(kLocationImages, kPathImages);
- AddInternalStorage(kLocationVideos, kPathVideos);
- AddInternalStorage(kLocationDownloads, kPathDownloads);
- AddInternalStorage(kLocationDocuments, kPathDocuments);
- AddInternalStorage(kLocationRingtones, kPathRingtones);
+ AddInternalStorage(kLocationCamera, tzplatform_getenv(TZ_USER_CAMERA));
+ AddInternalStorage(kLocationMusic, tzplatform_getenv(TZ_USER_SOUNDS));
+ AddInternalStorage(kLocationImages, tzplatform_getenv(TZ_USER_IMAGES));
+ AddInternalStorage(kLocationVideos, tzplatform_getenv(TZ_USER_VIDEOS));
+ AddInternalStorage(kLocationDownloads, tzplatform_getenv(TZ_USER_DOWNLOADS));
+ AddInternalStorage(kLocationDocuments, tzplatform_getenv(TZ_USER_DOCUMENTS));
+ AddInternalStorage(kLocationRingtones, \
+ tzplatform_mkpath(TZ_USER_SHARE, "settings/Ringtones"));
}
FilesystemInstance::~FilesystemInstance() {
void FilesystemInstance::HandleMessage(const char* message) {
picojson::value v;
-
std::string err;
picojson::parse(v, message, message + strlen(message), &err);
if (!err.empty()) {
std::string real_path_ack = std::string(real_path_cstr);
free(real_path_cstr);
- if (check_if_inside_default && real_path_ack.find(kDefaultPath) != 0) {
+ if (check_if_inside_default &&
+ real_path_ack.find(
+ tzplatform_getenv(TZ_USER_CONTENT)) != std::string::npos) {
PostAsyncErrorReply(msg, INVALID_VALUES_ERR);
return;
}
%bcond_with wayland
-%define _manifestdir /opt/share/packages
-%define _desktop_icondir /opt/share/icons/default/small
+%define _manifestdir %{TZ_SYS_RW_PACKAGES}
+%define _desktop_icondir %{TZ_SYS_SHARE}/icons/default/small
%define _bluetooth_demo_package tizen-extensions-crosswalk-bluetooth-demo
%define _examples_package tizen-extensions-crosswalk-examples
%define _system_info_demo_package tizen-extensions-crosswalk-system-info-demo
BuildRequires: pkgconfig(capi-system-runtime-info)
BuildRequires: pkgconfig(capi-system-sensor)
BuildRequires: pkgconfig(capi-system-system-settings)
+BuildRequires: pkgconfig(libtzplatform-config)
# For IVI, it doesn't need sim package.
%if "%{profile}" == "mobile"
BuildRequires: pkgconfig(capi-telephony-sim)
#include "system_info/system_info_storage.h"
#include <sys/statfs.h>
+#include <tzplatform_config.h>
#include <vconf.h>
#include "common/picojson.h"
namespace {
-const char* sStorageInternalPath = "/opt/usr/media";
-const char* sStorageSDCardPath = "/opt/storage/sdcard";
-
} // namespace
SysInfoStorage::SysInfoStorage()
bool SysInfoStorage::GetInternal(picojson::value& error,
picojson::value& unit) {
struct statfs fs;
- if (statfs(sStorageInternalPath, &fs) < 0) {
+ if (statfs(tzplatform_getenv(TZ_USER_CONTENT), &fs) < 0) {
system_info::SetPicoJsonObjectValue(error, "message",
picojson::value("Internal Storage path Error"));
return false;
}
struct statfs fs;
- if (statfs(sStorageInternalPath, &fs) < 0) {
+ if (statfs(tzplatform_getenv(TZ_USER_CONTENT), &fs) < 0) {
system_info::SetPicoJsonObjectValue(error, "message",
picojson::value("MMC mount path error"));
return false;
}
- statfs(sStorageSDCardPath, &fs);
+ statfs(tzplatform_mkpath(TZ_SYS_STORAGE, "sdcard"), &fs);
double available_capacity = static_cast<double>(fs.f_bsize) *
static_cast<double>(fs.f_bavail);
double capacity = static_cast<double>(fs.f_bsize) *
#include "system_info/system_info_utils.h"
#include <stdio.h>
+#include <tzplatform_config.h>
#include <unistd.h>
#include <algorithm>
FILE *fp = NULL;
static char duid[kDuid_buffer_size] = {0, };
size_t len = strlen(kDuid_str_key);
- fp = fopen("/opt/usr/etc/system_info_cache.ini", "r");
+ fp = fopen(tzplatform_mkpath(TZ_USER_ETC, "system_info_cache.ini"), "r");
if (fp) {
while (fgets(duid, kDuid_buffer_size - 1, fp)) {