[PATCH] D14231: [Support] Use GetTempDir to get the temporary dir path on Windows.

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 08:01:46 PST 2015


aaron.ballman added inline comments.

================
Comment at: unittests/Support/Path.cpp:366
@@ +365,3 @@
+
+  _wputenv_s(L"TMP", L"C:\\OtherFolder");
+  path::system_temp_directory(true, TempDir);
----------------
I am slightly worried about this for systems that don't mount a C drive, but I suspect those are passingly rare. ;-)

What has me way more worried is that failing these tests will not restore the TMP (and TEMP, below) environment variables. So if any of these tests fail, we leave the user's machine in a broken state. This can be solved with some RAII wrappers.

Further, changing the temp directory out from under the user affects *every* application on their machine. This means there's a non-zero chance that temp files start going to incorrect locations for other applications. I don't think there's a way to solve this, and I'm really not comfortable with that because it can lead to hard-to-trace problems for developers. Ideas most certainly welcome.


Repository:
  rL LLVM

http://reviews.llvm.org/D14231





More information about the llvm-commits mailing list