2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-23 05:21:06 +08:00
|
|
|
* Copyright (C) 2017-2020 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 01:46:50 +08:00
|
|
|
#include "utilities/directory.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-02-24 01:46:50 +08:00
|
|
|
#include "os_interface/windows/windows_wrapper.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-07-29 22:11:51 +08:00
|
|
|
std::vector<std::string> Directory::getFiles(const std::string &path) {
|
2017-12-21 07:45:38 +08:00
|
|
|
std::vector<std::string> files;
|
|
|
|
std::string newPath;
|
|
|
|
|
|
|
|
WIN32_FIND_DATAA ffd;
|
|
|
|
HANDLE hFind = INVALID_HANDLE_VALUE;
|
|
|
|
|
|
|
|
if (path.c_str()[path.size() - 1] == '/') {
|
|
|
|
return files;
|
|
|
|
} else {
|
|
|
|
newPath = path + "/*";
|
|
|
|
}
|
|
|
|
|
|
|
|
hFind = FindFirstFileA(newPath.c_str(), &ffd);
|
|
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE == hFind) {
|
|
|
|
return files;
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
files.push_back(path + "/" + ffd.cFileName);
|
|
|
|
} while (FindNextFileA(hFind, &ffd) != 0);
|
|
|
|
|
|
|
|
FindClose(hFind);
|
|
|
|
return files;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
}; // namespace NEO
|