Boost logo

Boost :

Subject: Re: [boost] [filesystem] temp_dir_path()
From: John B. Turpish (jbturp_at_[hidden])
Date: 2010-10-12 18:17:43

On Mon, Oct 11, 2010 at 9:19 AM, Jeff Flinn
<TriumphSprint2000_at_[hidden]> wrote:
> Stewart, Robert wrote:
>> Jeff Flinn wrote:
>>> Ulrich Eckhardt wrote:
>>>> In my experience, there are actually four of these TMP,
>>> calls TMPDIR the "canonical Unix
>>> environment variable" and refers to the following for that
>>> justification:
> Is there any consensus on this? What order should they be checked? Given the
> above links, I'd say TMPDIR should be first.
>>> Is the above reference sufficient to only rely on TMPDIR?
>> I don't think so, but I'm inclined to say don't look for /tmp.  That is,
>> rely on the environment as the sole means to find the correct directory and
>> if that is deficient, declare an error.
> I agree it's not a good idea to look for a fixed path. I don't have broad
> enough UNIX systems experience to make the call on whether to look for
> additional environment variables. If TMPDIR *is* the POSIX standard should
> that be all that we support?

I'm not going to pretend to be an expert, but I just ran a simple
test. Of those environment variables the only one I had set was TMPDIR
(I did not set up my envs and was surprised, actually). I compiled and
ran a program that did nothing more than print the return of
tmpnam(NULL) to std::cout. It resulted in a file that was in a
different directory than ${TMPDIR} (and not /tmp either). env | grep
'' provided me with nothing. So I do not know where
it got the directory for tmpnam(), but not from any env var.

Is it wrong for me to think tmpnam() would name to something in my
temporary directory?

Boost list run by bdawes at, gregod at, cpdaniel at, john at