*/
#include "common/filesystem/filesystem_provider_deviced.h"
+#include <system_info.h>
#include <gio/gio.h>
#include <algorithm>
#include "common/logger.h"
namespace {
+
static const char* kBus = "org.tizen.system.storage";
static const char* kBlockManagerIface = "org.tizen.system.storage.BlockManager";
static const char* kPath = "/Org/Tizen/System/Storage/Block/Manager";
static const char* kDeviceChangedMethod = "DeviceChanged";
static const char* kGetDeviceListMethod = "GetDeviceList";
+static const char* kExternalStorageFeature = "http://tizen.org/feature/storage.external";
+
+bool isExternalStorageSupported() {
+ bool external_storage_support = false;
+ auto ret = system_info_get_platform_bool(kExternalStorageFeature, &external_storage_support);
+
+ if (SYSTEM_INFO_ERROR_NONE != ret) {
+ LoggerE("system_info_get_platform_bool(storage.external) check failed: %d (%s)", ret,
+ get_error_message(ret));
+ return false;
+ }
+
+ if (!external_storage_support) {
+ LoggerW("External storage not supported.");
+ return false;
+ }
+
+ return true;
+}
+
} // namespace
namespace common {
return Storages();
}
- // internal storages are gathered with storage api
Storages internal = virtual_roots_provider_.GetStorages();
- // external storages are gathered using deviced implementation
+ if (!isExternalStorageSupported()) {
+ return internal;
+ }
+
+ LoggerD("Fetching external storages.");
Storages result;
GError* error = nullptr;
GVariant* variant = g_dbus_connection_call_sync(dbus_, kBus, kPath, kBlockManagerIface,
LoggerD("GetDeviceList succeed - handling result");
result = GetStoragesFromGVariant(variant);
}
-
// merging internal and external results together, but internal on the beginning
result.insert(result.begin(), internal.begin(), internal.end());
return result;