Revert r252366: [Support] Use GetTempDir to get the temporary dir path on Windows.
[oota-llvm.git] / lib / Support / Windows / Path.inc
index 30f0bb8204c64b1aa20200cfd7ada7af39e3a218..49910af55a79490e43f3b72fcc64b224fa5d9354 100644 (file)
@@ -754,9 +754,8 @@ std::error_code openFileForWrite(const Twine &Name, int &ResultFD,
 } // end namespace fs
 
 namespace path {
 } // end namespace fs
 
 namespace path {
-
-namespace {
-bool getKnownFolderPath(KNOWNFOLDERID folderId, SmallVectorImpl<char> &result) {
+static bool getKnownFolderPath(KNOWNFOLDERID folderId,
+                               SmallVectorImpl<char> &result) {
   wchar_t *path = nullptr;
   if (::SHGetKnownFolderPath(folderId, KF_FLAG_CREATE, nullptr, &path) != S_OK)
     return false;
   wchar_t *path = nullptr;
   if (::SHGetKnownFolderPath(folderId, KF_FLAG_CREATE, nullptr, &path) != S_OK)
     return false;
@@ -765,6 +764,9 @@ bool getKnownFolderPath(KNOWNFOLDERID folderId, SmallVectorImpl<char> &result) {
   ::CoTaskMemFree(path);
   return ok;
 }
   ::CoTaskMemFree(path);
   return ok;
 }
+
+bool getUserCacheDir(SmallVectorImpl<char> &Result) {
+  return getKnownFolderPath(FOLDERID_LocalAppData, Result);
 }
 
 bool home_directory(SmallVectorImpl<char> &result) {
 }
 
 bool home_directory(SmallVectorImpl<char> &result) {