You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

3 years ago
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <clang/AST/Decl.h>
#include <string>
namespace FileUtils {
/**
* Simplify away "." and ".." elements.
* If pathToNormalize is a relative path, it will be pre-pended with
* currentWorkingDirectory unless currentWorkingDirectory == "".
*/
std::string makeAbsolutePath(const std::string &currentWorkingDirectory,
std::string path);
/**
* Try to delete a prefix "repoRoot/" OR "sysRoot" from the given absolute path.
* If no rule applies AND keepExternalPaths is true, return the same path,
* otherwise return the empty string.
*/
std::string makeRelativePath(const std::string &repoRoot,
const std::string &sysRoot,
bool keepExternalPaths,
bool allowSiblingsToRoot,
const std::string &path);
} // namespace FileUtils