On Fri, 6 Dec 2002, Dirk-Willem van Gulik wrote:
> On Thu, 5 Dec 2002, Aaron Bannert wrote: > > > I don't like the idea of having environment variables drive things like > > this. Temp directories are a great way to get programs to write files > > wherever you want. I'd much rather have a function where the global > > tempdir can be set and then retrieved later by apr_get_temp_dir(). The > > nice thing about this is it doesn't incur any processing overhead when > > apr_get_temp_dir() is called, and can let apps like httpd create their > > own config directive for setting the preferred tempdir. > > Over the years the same discussion has been had in various unix forums - > and I have a strong feeling that the consensus reached there (or at least > the working assumption) that the ability to get a 'free to use' directory > reference was BAD - and that you are better off asking for a temp file > name; as to avoid clashes and all sorts of other mayem. > > What is the reason we MUST have a tempdir getter ? Just because there is > one on windows ? Is it really not enough to just do tempfile() getting ? > > It just feels like an operational rat hole (think for example a secure > unix) We already have a tempfile()-like API. People have asked for a way to get the file name for a unique file. We are providing an API that does this. However, you must have a place to put a temporary file, and each platform has a different location for such files. Unless you can think of another way to get a temp file name without using the systems temp directory, we have no other option. Forcing the app programmer to give us a path is a non-starter, because it means that the temp files will essentially never be in the correct location. Ryan