diff options
Diffstat (limited to 'lib/Support/Path.cpp')
-rw-r--r-- | lib/Support/Path.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index 8b9e60a2d9..a631c760fd 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -642,6 +642,17 @@ error_code unique_file(const Twine &Model, SmallVectorImpl<char> &ResultPath, return fs::remove(P); } +error_code createUniqueDirectory(const Twine &Prefix, + SmallVectorImpl<char> &ResultPath) { + // FIXME: This is double inefficient. We compute a unique file name, created + // it, delete it and keep only the directory. + error_code EC = unique_file(Prefix + "-%%%%%%/dummy", ResultPath); + if (EC) + return EC; + path::remove_filename(ResultPath); + return error_code::success(); +} + error_code make_absolute(SmallVectorImpl<char> &path) { StringRef p(path.data(), path.size()); |