Hi, llvm::sys::path allows the user to query "known directory" paths: temp, cache, home. I was tweaking this area a bit for some time. I would like to propose a small redesign. What we have so far? home_directory() tries to return what it promises. No issues with that. system_temp_directory(true) returns a path to a directory that can be erased on reboot. On Linux it is usually /tmp. On Windows and OSX it returns user's temp directories as a first choice. system_temp_directory(false) returns a path to a directory that is not cleared on reboot. On Linux it is usually /var/tmp. On Windows is the same as system_temp_directory(true). On OSX it is user's cache directory. user_cache_directory() returns a path to user's cache directory. Redesign proposal: 1. Add function temp_directory() - a replacement for system_temp_directory(true). If it returns system or user temp directory is OS-specific. Same as system_temp_directory() it always succeed. 2. Implement system_temp_directory(bool) in terms of temp_directory() and user_cache_directory(). 3. Deprecate system_temp_directory(bool). Comments? - Paweł -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151119/12c36177/attachment.html>
On Thu, Nov 19, 2015 at 6:50 AM, Paweł Bylica <chfast at gmail.com> wrote:> Hi, > > llvm::sys::path allows the user to query "known directory" paths: temp, > cache, home. I was tweaking this area a bit for some time. I would like to > propose a small redesign. > > What we have so far? > > home_directory() tries to return what it promises. No issues with that. > > system_temp_directory(true) returns a path to a directory that can be erased > on reboot. On Linux it is usually /tmp. On Windows and OSX it returns user's > temp directories as a first choice. > > system_temp_directory(false) returns a path to a directory that is not > cleared on reboot. On Linux it is usually /var/tmp. On Windows is the same > as system_temp_directory(true). On OSX it is user's cache directory. > > user_cache_directory() returns a path to user's cache directory. > > Redesign proposal: > > Add function temp_directory() - a replacement for > system_temp_directory(true). If it returns system or user temp directory is > OS-specific. Same as system_temp_directory() it always succeed. > Implement system_temp_directory(bool) in terms of temp_directory() and > user_cache_directory(). > Deprecate system_temp_directory(bool). > > Comments?We appear to use both system_temp_directory(true) and system_temp_directory(false) in ways that seem like they could matter. For instance, modules uses a temp directory that does not get erased on reboot, possibly for performance reasons. Do we gain something from deprecating system_temp_directory()? ~Aaron
Rafael Espíndola via llvm-dev
2015-Nov-23 20:07 UTC
[llvm-dev] [Path] RFC: Known directories
> We appear to use both system_temp_directory(true) and > system_temp_directory(false) in ways that seem like they could matter. > For instance, modules uses a temp directory that does not get erased > on reboot, possibly for performance reasons. Do we gain something from > deprecating system_temp_directory()?I have a small preference for having the distinction in the name: *_temp_* -> something that is one use and potentially deleted often *_cache_* -> something we would like to save (modules for example). So what we gain is clarity over a bool parameter. Cheers, Rafael
Seemingly Similar Threads
- [Path] RFC: Known directories
- [Path] RFC: Known directories
- [LLVMdev] sys::path::system_temp_directory vs. sys::fs::createTemporaryFile
- [LLVMdev] sys::path::system_temp_directory vs. sys::fs::createTemporaryFile
- llvm::sys::path::home_directory() implementation for unix