sl@0: #ifndef BOOST_ARCHIVE_TMPDIR_HPP
sl@0: #define BOOST_ARCHIVE_TMPDIR_HPP
sl@0: 
sl@0: // MS compatible compilers support #pragma once
sl@0: #if defined(_MSC_VER) && (_MSC_VER >= 1020)
sl@0: # pragma once
sl@0: #endif
sl@0: 
sl@0: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
sl@0: // tmpdir.hpp:
sl@0: 
sl@0: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
sl@0: // Use, modification and distribution is subject to the Boost Software
sl@0: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
sl@0: // http://www.boost.org/LICENSE_1_0.txt)
sl@0: 
sl@0: //  See http://www.boost.org for updates, documentation, and revision history.
sl@0: 
sl@0: #include <cstdlib> // getenv
sl@0: #include <cassert>
sl@0: 
sl@0: #include <boost/config.hpp>
sl@0: #ifdef BOOST_NO_STDC_NAMESPACE
sl@0: namespace std {
sl@0:     using ::getenv;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: namespace boost {
sl@0: namespace archive {
sl@0: 
sl@0: inline char * tmpdir(){
sl@0:     char *dirname;
sl@0:     dirname = std::getenv("TMP");
sl@0:     if(NULL == dirname)
sl@0:         dirname = std::getenv("TMPDIR");
sl@0:     if(NULL == dirname)
sl@0:         dirname = std::getenv("TEMP");
sl@0:     if(NULL == dirname){
sl@0:         //assert(false); // no temp directory found
sl@0:         dirname = ".";
sl@0:     }
sl@0:     return dirname;
sl@0: }
sl@0: 
sl@0: } // archive
sl@0: } // boost
sl@0: 
sl@0: #endif // BOOST_ARCHIVE_TMPDIR_HPP