~ubuntu-branches/debian/stretch/bitcoin/stretch

« back to all changes in this revision

Viewing changes to src/test/testutil.cpp

  • Committer: Package Import Robot
  • Author(s): Anthony Towns
  • Date: 2016-10-21 17:13:13 UTC
  • mfrom: (1.3.2)
  • Revision ID: package-import@ubuntu.com-20161021171313-7eu2ltpbk0xag3q1
Tags: 0.13.0-0.1
* Non-maintainer upload.
* New upstream release.
* Allow compilation with gcc/g++ 6. (Closes: Bug#835963)
* Additional fixes for openssl 1.1 compatibility. (See Bug#828248)
* Check if -latomic is needed (it is on mips*).
* Remove reproducible build patch, since leveldb build system is
  no longer used in 0.13. (See Bug#791834)
* Update description since the blockchain is much more than "several GB"
  now. (Closes: Bug#835809)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
4
 
 
5
#include "testutil.h"
 
6
 
 
7
#ifdef WIN32
 
8
#include <shlobj.h>
 
9
#endif
 
10
 
 
11
#include <boost/filesystem.hpp>
 
12
 
 
13
boost::filesystem::path GetTempPath() {
 
14
#if BOOST_FILESYSTEM_VERSION == 3
 
15
    return boost::filesystem::temp_directory_path();
 
16
#else
 
17
    // TODO: remove when we don't support filesystem v2 anymore
 
18
    boost::filesystem::path path;
 
19
#ifdef WIN32
 
20
    char pszPath[MAX_PATH] = "";
 
21
 
 
22
    if (GetTempPathA(MAX_PATH, pszPath))
 
23
        path = boost::filesystem::path(pszPath);
 
24
#else
 
25
    path = boost::filesystem::path("/tmp");
 
26
#endif
 
27
    if (path.empty() || !boost::filesystem::is_directory(path)) {
 
28
        LogPrintf("GetTempPath(): failed to find temp path\n");
 
29
        return boost::filesystem::path("");
 
30
    }
 
31
    return path;
 
32
#endif
 
33
}