Fix compilation issues on systems without std::filesystem (#23)

[ROCm/rocjpeg commit: 764ae2a348]
This commit is contained in:
Aryan Salmanpour
2024-05-08 15:57:19 -04:00
committed by GitHub
parent f4bf8cfe17
commit 1a61bd56f2
3 changed files with 18 additions and 1 deletions
@@ -499,7 +499,11 @@ void RocJpegVappiDecoder::GetVisibleDevices(std::vector<int>& visible_devices_ve
void RocJpegVappiDecoder::GetCurrentComputePartition(std::vector<ComputePartition> &current_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()) {