/// symlinks. For real file system, this uses `llvm::sys::fs::real_path`.
/// This returns errc::operation_not_permitted if not implemented by subclass.
virtual std::error_code getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const;
+ SmallVectorImpl<char> &Output,
+ bool ExpandTilde = false) const;
/// Check whether a file exists. Provided for convenience.
bool exists(const Twine &Path);
llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override;
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
std::error_code isLocal(const Twine &Path, bool &Result) override;
- std::error_code getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const override;
+ std::error_code getRealPath(const Twine &Path, SmallVectorImpl<char> &Output,
+ bool ExpandTilde = false) const override;
using iterator = FileSystemList::reverse_iterator;
using const_iterator = FileSystemList::const_reverse_iterator;
std::error_code setCurrentWorkingDirectory(const Twine &Path) override {
return FS->setCurrentWorkingDirectory(Path);
}
- std::error_code getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const override {
- return FS->getRealPath(Path, Output);
+ std::error_code getRealPath(const Twine &Path, SmallVectorImpl<char> &Output,
+ bool ExpandTilde = false) const override {
+ return FS->getRealPath(Path, Output, ExpandTilde);
}
protected:
///
/// This doesn't resolve symlinks as they are not supported in in-memory file
/// system.
- std::error_code getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const override;
+ std::error_code getRealPath(const Twine &Path, SmallVectorImpl<char> &Output,
+ bool ExpandTilde = false) const override;
std::error_code isLocal(const Twine &Path, bool &Result) override;
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
};
}
std::error_code FileSystem::getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const {
+ SmallVectorImpl<char> &Output,
+ bool ExpandTilde) const {
return errc::operation_not_permitted;
}
llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override;
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
std::error_code isLocal(const Twine &Path, bool &Result) override;
- std::error_code getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const override;
+ std::error_code getRealPath(const Twine &Path, SmallVectorImpl<char> &Output,
+ bool ExpandTilde = false) const override;
private:
mutable std::mutex CWDMutex;
return llvm::sys::fs::is_local(Path, Result);
}
-std::error_code
-RealFileSystem::getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const {
+std::error_code RealFileSystem::getRealPath(const Twine &Path,
+ SmallVectorImpl<char> &Output,
+ bool ExpandTilde) const {
return llvm::sys::fs::real_path(Path, Output);
}
return errc::no_such_file_or_directory;
}
-std::error_code
-OverlayFileSystem::getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const {
+std::error_code OverlayFileSystem::getRealPath(const Twine &Path,
+ SmallVectorImpl<char> &Output,
+ bool ExpandTilde) const {
for (auto &FS : FSList)
if (FS->exists(Path))
- return FS->getRealPath(Path, Output);
+ return FS->getRealPath(Path, Output, ExpandTilde);
return errc::no_such_file_or_directory;
}
return {};
}
-std::error_code
-InMemoryFileSystem::getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const {
+std::error_code InMemoryFileSystem::getRealPath(const Twine &Path,
+ SmallVectorImpl<char> &Output,
+ bool ExpandTilde) const {
auto CWD = getCurrentWorkingDirectory();
if (!CWD || CWD->empty())
return errc::operation_not_permitted;
return std::error_code();
}
// Map any symlink to "/symlink".
- std::error_code getRealPath(const Twine &Path,
- SmallVectorImpl<char> &Output) const override {
+ std::error_code getRealPath(const Twine &Path, SmallVectorImpl<char> &Output,
+ bool ExpandTilde) const override {
auto I = FilesAndDirs.find(Path.str());
if (I == FilesAndDirs.end())
return make_error_code(llvm::errc::no_such_file_or_directory);