mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
bc98e0079f
The new value is 21.
36 lines
927 B
C++
36 lines
927 B
C++
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
#include "llvm/Support/Path.h"
|
|
|
|
std::string getCurrentExecutableFullPath();
|
|
std::string getCurrentRoot();
|
|
|
|
template<typename... T>
|
|
requires(std::is_convertible_v<T, llvm::StringRef> && ...)
|
|
std::string joinPath(const llvm::StringRef First, const T... Parts) {
|
|
llvm::SmallString<128> ResultPath(First);
|
|
(llvm::sys::path::append(ResultPath, Parts), ...);
|
|
return ResultPath.str().str();
|
|
}
|
|
|
|
class PathList {
|
|
public:
|
|
PathList(const std::vector<std::string> &Paths) : SearchPaths(Paths) {}
|
|
|
|
std::optional<std::string> findFile(llvm::StringRef FileName) const;
|
|
std::vector<std::string> list(llvm::StringRef Path,
|
|
llvm::StringRef Suffix) const;
|
|
|
|
private:
|
|
std::vector<std::string> SearchPaths;
|
|
};
|