2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2020-02-22 22:21:06 +01:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 18:46:50 +01:00
|
|
|
#include "utilities/directory.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
#include <cstdio>
|
|
|
|
|
#include <dirent.h>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-07-29 16:11:51 +02:00
|
|
|
std::vector<std::string> Directory::getFiles(const std::string &path) {
|
2017-12-21 00:45:38 +01:00
|
|
|
std::vector<std::string> files;
|
|
|
|
|
|
|
|
|
|
DIR *dir = opendir(path.c_str());
|
|
|
|
|
if (dir == nullptr) {
|
|
|
|
|
return files;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct dirent *entry = nullptr;
|
|
|
|
|
while ((entry = readdir(dir)) != nullptr) {
|
|
|
|
|
if (entry->d_name[0] == '.') {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string fullPath;
|
|
|
|
|
fullPath += path;
|
|
|
|
|
fullPath += "/";
|
|
|
|
|
fullPath += entry->d_name;
|
|
|
|
|
|
|
|
|
|
files.push_back(fullPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closedir(dir);
|
|
|
|
|
return files;
|
|
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
}; // namespace NEO
|