[PATCH] D13801: [Support] Extend sys::path with user_cache_directory function.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 08:59:52 PDT 2015


> and the above would be replaced with:
> ```
> if (sys::path::user_cache_directory(Dir, "LLVM", "Kaleidoscope")) {
>   sys::path::append(Dir, CacheFileName);
> }
> ```
>
> Which one is better?

The second one if at least the first argument is mandatory. That way
we make sure we never write directly to the top level folder.

> ================
> Comment at: lib/Support/Unix/Path.inc:636
> @@ -585,3 +635,3 @@
>
>  void system_temp_directory(bool ErasedOnReboot, SmallVectorImpl<char> &Result) {
>    Result.clear();
> ----------------
> rafael wrote:
>> Should we drop the EraseOnReboot argument from this function? We would now have
>>
>>  user_cache_directory
>>  system_temp_directory(true
>>  system_temp_directory(false
>>
>> When should each one be used?
> user_cache_directory is similar to system_temp_directory(false) (level of similarity is OS-specific). We can drop system_temp_directory(false) then, but because it is the API change it's probably bad idea to do it at once.
>
> In the end I would like to have:
> user_cache_directory
> system_temp_directory
> and maybe user_temp_directory
>
> I think that needs to be discussed. And we can agree on the final solution I'm happy to implement it.

Awesome. Yes, multiple patches are better.

Cheers,
Rafael


More information about the llvm-commits mailing list