Skip to content

Commit 69675d2

Browse files
authored
Merge pull request #1484 from madhuy/hotfix/1393
Hotfix/1393 - getting ListFiles from filesytem instead from Cache
2 parents e5a5aad + aac8cc1 commit 69675d2

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/components/application_manager/src/commands/mobile/list_files_request.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,21 @@ void ListFilesRequest::Run() {
7676

7777
(*message_)[strings::msg_params][strings::space_available] =
7878
static_cast<int32_t>(application->GetAvailableDiskSpace());
79+
// Enumarating through File system
7980
uint32_t i = 0;
80-
const AppFilesMap& app_files = application->getAppFiles();
81-
for (AppFilesMap::const_iterator it = app_files.begin();
82-
it != app_files.end();
83-
++it) {
84-
std::string filename = it->first.substr(it->first.find_last_of('/') + 1);
85-
// In AppFile to application stored full path to file. In message required
86-
// to write only name file.
87-
// Plus one required for move to next letter after '/'.
81+
std::string directory_name =
82+
application_manager_.get_settings().app_storage_folder();
83+
directory_name += "/" + application->folder_name();
84+
std::vector<std::string> persistent_files =
85+
file_system::ListFiles(directory_name);
86+
std::vector<std::string>::const_iterator it = persistent_files.begin();
87+
for (; it != persistent_files.end(); ++it) {
8888
if (i < application_manager_.get_settings().list_files_response_size()) {
89-
LOG4CXX_DEBUG(logger_,
90-
"File " + filename + " added to ListFiles response");
91-
(*message_)[strings::msg_params][strings::filenames][i++] = filename;
89+
LOG4CXX_DEBUG(logger_, "File " + *it + " added to ListFiles response");
90+
(*message_)[strings::msg_params][strings::filenames][i++] = *it;
9291
} else {
9392
LOG4CXX_DEBUG(logger_,
94-
"File " + filename + " not added to ListFiles response");
93+
"File " + *it + " not added to ListFiles response");
9594
}
9695
}
9796
(*message_)[strings::params][strings::message_type] =

0 commit comments

Comments
 (0)