Skip to content

Commit

Permalink
fix create key dir
Browse files Browse the repository at this point in the history
  • Loading branch information
sinev-valentine committed Nov 21, 2018
1 parent d81469a commit e014ba9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion keychain_lib/include/keychain_lib/keychain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "keychain_commands.hpp"

#ifdef __linux__
#define KEY_DEFAULT_PATH "/var/keychain/key_data"
#define KEY_DEFAULT_PATH "/var/keychain"
#define LOG_DEFAULT_PATH "/var/keychain/logs"
#else

Expand Down
20 changes: 11 additions & 9 deletions keychain_lib/src/keychain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <boost/hana.hpp>


using namespace keychain_app;

keychain_commands_singletone::keychain_commands_singletone()
Expand All @@ -44,24 +45,25 @@ keychain::keychain(const secure_dlg_mod_base* secure_dlg, const char* default_ke
{
binary_dir = bfs::absolute("").string();

std::string user_dir(default_key_dir);
bfs::path path_(user_dir);
if(!bfs::exists(path_))
{
auto res = bfs::create_directory(path_);
if(res == false)
throw std::runtime_error("Error: can not create default key directory");
}
std::string dir(default_key_dir);
bfs::path key_dir(dir);

key_dir += "/key_data";

if(!bfs::exists(key_dir))
{
auto res = bfs::create_directories(key_dir);
if(res == false)
throw std::runtime_error("Error: can not create key directory");
}

get_passwd_trx_raw.connect(std::bind(&secure_dlg_mod_base::get_passwd_trx_raw, secure_dlg,
std::placeholders::_1, std::placeholders::_2));
get_passwd_on_create.connect(std::bind(&secure_dlg_mod_base::get_passwd_on_create, secure_dlg,
std::placeholders::_1));
print_mnemonic.connect(std::bind(&secure_dlg_mod_base::print_mnemonic, secure_dlg,
std::placeholders::_1));
bfs::current_path(path_);
bfs::current_path(key_dir);
}

keychain::~keychain()
Expand Down

0 comments on commit e014ba9

Please sign in to comment.