2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "runtime/utilities/directory.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include <cstdio>
|
|
|
|
#include <dirent.h>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
std::vector<std::string> Directory::getFiles(std::string &path) {
|
|
|
|
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 18:59:46 +08:00
|
|
|
}; // namespace NEO
|