diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 20:00:46 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 20:00:46 +0000 |
| commit | 0414e226b73ef7952be3ef346c1c802e7f036f54 (patch) | |
| tree | ff0114c0524108a01707e4101f3224db0d7fd01f /lib/Basic/VirtualFileSystem.cpp | |
| parent | 97b17066aaac3f1590a809d79abe98fde03821ec (diff) | |
Notes
Diffstat (limited to 'lib/Basic/VirtualFileSystem.cpp')
| -rw-r--r-- | lib/Basic/VirtualFileSystem.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Basic/VirtualFileSystem.cpp b/lib/Basic/VirtualFileSystem.cpp index cf5a8d681eac..6977f400287f 100644 --- a/lib/Basic/VirtualFileSystem.cpp +++ b/lib/Basic/VirtualFileSystem.cpp @@ -658,6 +658,23 @@ directory_iterator InMemoryFileSystem::dir_begin(const Twine &Dir, EC = make_error_code(llvm::errc::not_a_directory); return directory_iterator(std::make_shared<InMemoryDirIterator>()); } + +std::error_code InMemoryFileSystem::setCurrentWorkingDirectory(const Twine &P) { + SmallString<128> Path; + P.toVector(Path); + + // Fix up relative paths. This just prepends the current working directory. + std::error_code EC = makeAbsolute(Path); + assert(!EC); + (void)EC; + + if (useNormalizedPaths()) + llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true); + + if (!Path.empty()) + WorkingDirectory = Path.str(); + return std::error_code(); +} } } |
