1
// Copyright (c) 2009-2016 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
11
#include <boost/filesystem.hpp>
13
boost::filesystem::path GetTempPath() {
14
#if BOOST_FILESYSTEM_VERSION == 3
15
return boost::filesystem::temp_directory_path();
17
// TODO: remove when we don't support filesystem v2 anymore
18
boost::filesystem::path path;
20
char pszPath[MAX_PATH] = "";
22
if (GetTempPathA(MAX_PATH, pszPath))
23
path = boost::filesystem::path(pszPath);
25
path = boost::filesystem::path("/tmp");
27
if (path.empty() || !boost::filesystem::is_directory(path)) {
28
LogPrintf("GetTempPath(): failed to find temp path\n");
29
return boost::filesystem::path("");