stc
Loading...
Searching...
No Matches
FileUtil.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <filesystem>
8#include <optional>
9#include <vector>
10
11namespace stc::FileUtil {
12
21inline std::optional<std::filesystem::path> findFile(
22 const std::vector<std::filesystem::path>& searchPath,
23 const std::filesystem::path& filename
24) {
25 for (auto& path : searchPath) {
26 if (std::filesystem::is_regular_file(path / filename)) {
27 return path / filename;
28 }
29 }
30 return std::nullopt;
31}
32
33}
Definition FileUtil.hpp:11
std::optional< std::filesystem::path > findFile(const std::vector< std::filesystem::path > &searchPath, const std::filesystem::path &filename)
Definition FileUtil.hpp:21