Fix compilation issues on systems without std::filesystem (#23)
Esse commit está contido em:
@@ -156,10 +156,19 @@ void RocJpegUtils::ParseCommandLine(std::string &input_path, std::string &output
|
||||
}
|
||||
|
||||
bool RocJpegUtils::GetFilePaths(std::string &input_path, std::vector<std::string> &file_paths, bool &is_dir, bool &is_file) {
|
||||
#if __cplusplus >= 201703L && __has_include(<filesystem>)
|
||||
is_dir = std::filesystem::is_directory(input_path);
|
||||
is_file = std::filesystem::is_regular_file(input_path);
|
||||
#else
|
||||
is_dir = std::experimental::filesystem::is_directory(input_path);
|
||||
is_file = std::experimental::filesystem::is_regular_file(input_path);
|
||||
#endif
|
||||
if (is_dir) {
|
||||
#if __cplusplus >= 201703L && __has_include(<filesystem>)
|
||||
for (const auto &entry : std::filesystem::directory_iterator(input_path))
|
||||
#else
|
||||
for (const auto &entry : std::experimental::filesystem::directory_iterator(input_path))
|
||||
#endif
|
||||
file_paths.push_back(entry.path());
|
||||
} else if (is_file) {
|
||||
file_paths.push_back(input_path);
|
||||
|
||||
@@ -499,7 +499,11 @@ void RocJpegVappiDecoder::GetVisibleDevices(std::vector<int>& visible_devices_ve
|
||||
void RocJpegVappiDecoder::GetCurrentComputePartition(std::vector<ComputePartition> ¤t_compute_partitions) {
|
||||
std::string search_path = "/sys/devices/";
|
||||
std::string partition_file = "current_compute_partition";
|
||||
#if __cplusplus >= 201703L && __has_include(<filesystem>)
|
||||
for (const auto& entry : std::filesystem::recursive_directory_iterator(search_path)) {
|
||||
#else
|
||||
for (const auto& entry : std::experimental::filesystem::recursive_directory_iterator(search_path)) {
|
||||
#endif
|
||||
if (entry.path().filename() == partition_file) {
|
||||
std::ifstream file(entry.path());
|
||||
if (file.is_open()) {
|
||||
|
||||
@@ -31,7 +31,11 @@ THE SOFTWARE.
|
||||
#include <string>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <filesystem>
|
||||
#if __cplusplus >= 201703L && __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
#else
|
||||
#include <experimental/filesystem>
|
||||
#endif
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
#include <va/va.h>
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário