Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
filesystem_util.cpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 //
3 // SPDX-License-Identifier: LGPL-3.0+
4 
6 
7 namespace libzeth
8 {
9 
10 boost::filesystem::path get_path_to_setup_directory()
11 {
12  // If the ZETH_SETUP_DIR env var is not set, check HOME, and
13  // fallback to current directory.
14 
15  const char *path = std::getenv("ZETH_SETUP_DIR");
16  if (path != nullptr) {
17  return path;
18  }
19 
20  path = std::getenv("HOME");
21  if (path != nullptr) {
22  return boost::filesystem::path(path) / "zeth_setup";
23  }
24 
25  return "";
26 }
27 
28 boost::filesystem::path get_path_to_debug_directory()
29 {
30  const char *path = std::getenv("ZETH_DEBUG_DIR");
31  if (path != nullptr) {
32  return boost::filesystem::path(path);
33  }
34 
35  // Fallback destination if the ZETH_DEBUG_DIR env var is not set
36  // We assume below that `std::getenv("HOME")` does not return `nullptr`
37  boost::filesystem::path home_path =
38  boost::filesystem::path(std::getenv("HOME"));
39  boost::filesystem::path zeth_debug("zeth_debug");
40  boost::filesystem::path default_path = home_path / zeth_debug;
41  return default_path;
42 }
43 
44 } // namespace libzeth
libzeth
Definition: binary_operation.hpp:15
libzeth::get_path_to_debug_directory
boost::filesystem::path get_path_to_debug_directory()
Definition: filesystem_util.cpp:28
filesystem_util.hpp
libzeth::get_path_to_setup_directory
boost::filesystem::path get_path_to_setup_directory()
Definition: filesystem_util.cpp:10