utils: Remove unnecessary GetTempPath()
This commit is contained in:
parent
3cf87df03c
commit
d7c80e760c
|
@ -9,8 +9,6 @@ noinst_PROGRAMS += zcash-gtest
|
|||
# test_checktransaction.cpp MUST be before
|
||||
# any test that calls SelectParams().
|
||||
zcash_gtest_SOURCES = \
|
||||
test/testutil.cpp \
|
||||
test/testutil.h \
|
||||
gtest/main.cpp \
|
||||
gtest/utils.cpp \
|
||||
gtest/utils.h \
|
||||
|
|
|
@ -102,8 +102,6 @@ BITCOIN_TESTS =\
|
|||
test/test_random.h \
|
||||
test/test_util.cpp \
|
||||
test/test_util.h \
|
||||
test/testutil.cpp \
|
||||
test/testutil.h \
|
||||
test/torcontrol_tests.cpp \
|
||||
test/transaction_tests.cpp \
|
||||
test/txvalidationcache_tests.cpp \
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#include "util.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
||||
#include "test/testutil.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using namespace boost::placeholders;
|
||||
|
@ -125,7 +123,7 @@ TEST_F(DeprecationTest, DeprecatedNodeIgnoredOnTestnet) {
|
|||
}
|
||||
|
||||
TEST_F(DeprecationTest, AlertNotify) {
|
||||
fs::path temp = GetTempPath() /
|
||||
fs::path temp = fs::temp_directory_path() /
|
||||
fs::unique_path("alertnotify-%%%%.txt");
|
||||
|
||||
mapArgs["-alertnotify"] = std::string("echo %s >> ") + temp.string();
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "utiltest.h"
|
||||
#include "warnings.h"
|
||||
|
||||
#include "test/testutil.h"
|
||||
#include "test/test_bitcoin.h"
|
||||
|
||||
#include <fstream>
|
||||
|
@ -354,7 +353,7 @@ BOOST_AUTO_TEST_CASE(AlertNotify)
|
|||
SetMockTime(11);
|
||||
const std::vector<unsigned char>& alertKey = Params(CBaseChainParams::MAIN).AlertKey();
|
||||
|
||||
fs::path temp = GetTempPath() /
|
||||
fs::path temp = fs::temp_directory_path() /
|
||||
fs::unique_path("alertnotify-%%%%.txt");
|
||||
|
||||
mapArgs["-alertnotify"] = std::string("echo %s >> ") + temp.string();
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include "rpc/server.h"
|
||||
#include "rpc/register.h"
|
||||
|
||||
#include "test/testutil.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
|
@ -96,7 +94,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : JoinSplitTestingSetup
|
|||
orig_current_path = fs::current_path();
|
||||
|
||||
ClearDatadirCache();
|
||||
pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
|
||||
pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
|
||||
fs::create_directories(pathTemp);
|
||||
mapArgs["-datadir"] = pathTemp.string();
|
||||
pblocktree = new CBlockTreeDB(1 << 20, true);
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) 2009-2016 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "testutil.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#include "fs.h"
|
||||
|
||||
fs::path GetTempPath() {
|
||||
#if BOOST_FILESYSTEM_VERSION == 3
|
||||
return fs::temp_directory_path();
|
||||
#else
|
||||
// TODO: remove when we don't support filesystem v2 anymore
|
||||
fs::path path;
|
||||
#ifdef WIN32
|
||||
char pszPath[MAX_PATH] = "";
|
||||
|
||||
if (GetTempPathA(MAX_PATH, pszPath))
|
||||
path = fs::path(pszPath);
|
||||
#else
|
||||
path = fs::path("/tmp");
|
||||
#endif
|
||||
if (path.empty() || !fs::is_directory(path)) {
|
||||
LogPrintf("GetTempPath(): failed to find temp path\n");
|
||||
return fs::path("");
|
||||
}
|
||||
return path;
|
||||
#endif
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) 2009-2016 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
/**
|
||||
* Utility functions shared by unit tests
|
||||
*/
|
||||
#ifndef BITCOIN_TEST_TESTUTIL_H
|
||||
#define BITCOIN_TEST_TESTUTIL_H
|
||||
|
||||
#include "fs.h"
|
||||
|
||||
fs::path GetTempPath();
|
||||
|
||||
#endif // BITCOIN_TEST_TESTUTIL_H
|
Loading…
Reference in New Issue