annotate DEPENDENCIES/generic/include/boost/archive/tmpdir.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 #ifndef BOOST_ARCHIVE_TMPDIR_HPP
Chris@16 2 #define BOOST_ARCHIVE_TMPDIR_HPP
Chris@16 3
Chris@16 4 // MS compatible compilers support #pragma once
Chris@101 5 #if defined(_MSC_VER)
Chris@16 6 # pragma once
Chris@16 7 #endif
Chris@16 8
Chris@16 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
Chris@16 10 // tmpdir.hpp:
Chris@16 11
Chris@16 12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
Chris@16 13 // Use, modification and distribution is subject to the Boost Software
Chris@16 14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 15 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 16
Chris@16 17 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 18
Chris@16 19 #include <cstdlib> // getenv
Chris@16 20 #include <cstddef> // NULL
Chris@16 21 //#include <boost/assert.hpp>
Chris@16 22
Chris@16 23 #include <boost/config.hpp>
Chris@16 24 #ifdef BOOST_NO_STDC_NAMESPACE
Chris@16 25 namespace std {
Chris@16 26 using ::getenv;
Chris@16 27 }
Chris@16 28 #endif
Chris@16 29
Chris@16 30 namespace boost {
Chris@16 31 namespace archive {
Chris@16 32
Chris@16 33 inline const char * tmpdir(){
Chris@16 34 const char *dirname;
Chris@16 35 dirname = std::getenv("TMP");
Chris@16 36 if(NULL == dirname)
Chris@16 37 dirname = std::getenv("TMPDIR");
Chris@16 38 if(NULL == dirname)
Chris@16 39 dirname = std::getenv("TEMP");
Chris@16 40 if(NULL == dirname){
Chris@16 41 //BOOST_ASSERT(false); // no temp directory found
Chris@16 42 dirname = ".";
Chris@16 43 }
Chris@16 44 return dirname;
Chris@16 45 }
Chris@16 46
Chris@16 47 } // archive
Chris@16 48 } // boost
Chris@16 49
Chris@16 50 #endif // BOOST_ARCHIVE_TMPDIR_HPP