Files
compute-runtime/core/utilities/linux/directory.cpp
Mateusz Jablonski 6ef7fc726b Update copyright headers
Change-Id: I05eaad34f5af15685c6ad6d5bb3078f21dd1e0af
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2020-02-22 23:44:04 +01:00

41 lines
762 B
C++

/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/utilities/directory.h"
#include <cstdio>
#include <dirent.h>
namespace NEO {
std::vector<std::string> Directory::getFiles(const 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;
}
}; // namespace NEO