Passing nano::networks enum in to working_path rather than statically constructing it.
This commit is contained in:
parent
210f725e16
commit
c2f19a3837
3 changed files with 8 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/logging.hpp>
|
||||
#include <nano/secure/utility.hpp>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
|
@ -9,7 +10,6 @@ namespace nano
|
|||
{
|
||||
void cleanup_dev_directories_on_exit ();
|
||||
void force_nano_dev_network ();
|
||||
boost::filesystem::path unique_path ();
|
||||
}
|
||||
|
||||
GTEST_API_ int main (int argc, char ** argv)
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
|
||||
static std::vector<boost::filesystem::path> all_unique_paths;
|
||||
|
||||
boost::filesystem::path nano::working_path ()
|
||||
boost::filesystem::path nano::working_path (nano::networks network)
|
||||
{
|
||||
static nano::network_constants network_constants;
|
||||
auto result (nano::app_path ());
|
||||
switch (network_constants.network ())
|
||||
switch (network)
|
||||
{
|
||||
case nano::networks::invalid:
|
||||
release_assert (false);
|
||||
|
@ -31,9 +30,9 @@ boost::filesystem::path nano::working_path ()
|
|||
return result;
|
||||
}
|
||||
|
||||
boost::filesystem::path nano::unique_path ()
|
||||
boost::filesystem::path nano::unique_path (nano::networks network)
|
||||
{
|
||||
auto result (working_path () / boost::filesystem::unique_path ());
|
||||
auto result (working_path (network) / boost::filesystem::unique_path ());
|
||||
all_unique_paths.push_back (result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <crypto/cryptopp/osrng.h>
|
||||
#include <nano/lib/config.hpp>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
// OS-specific way of finding a path to a home directory.
|
||||
boost::filesystem::path working_path ();
|
||||
boost::filesystem::path working_path (nano::networks network = nano::network_constants::active_network);
|
||||
// Get a unique path within the home directory, used for testing.
|
||||
// Any directories created at this location will be removed when a test finishes.
|
||||
boost::filesystem::path unique_path ();
|
||||
boost::filesystem::path unique_path (nano::networks network = nano::network_constants::active_network);
|
||||
// Remove all unique tmp directories created by the process
|
||||
void remove_temporary_directories ();
|
||||
// Generic signal handler declarations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue