Skip to content

Commit c8bad63

Browse files
authored
Merge pull request #223 from eosnetworkfoundation/preemptively-create-wallet-dir
Backported code to preemptively create wallet dir
2 parents 6947890 + 0b4ae42 commit c8bad63

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

plugins/wallet_plugin/wallet_plugin.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ void wallet_plugin::plugin_initialize(const variables_map& options) {
4242
if (options.count("wallet-dir")) {
4343
auto dir = options.at("wallet-dir").as<boost::filesystem::path>();
4444
if (dir.is_relative())
45-
wallet_manager_ptr->set_dir(app().data_dir() / dir);
46-
else
47-
wallet_manager_ptr->set_dir(dir);
45+
dir = app().data_dir() / dir;
46+
if( !bfs::exists(dir) )
47+
bfs::create_directories(dir);
48+
wallet_manager_ptr->set_dir(dir);
4849
}
4950
if (options.count("unlock-timeout")) {
5051
auto timeout = options.at("unlock-timeout").as<int64_t>();

programs/keosd/main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,13 @@ int main(int argc, char** argv)
8484
.default_http_port = 0
8585
});
8686
app().register_plugin<wallet_api_plugin>();
87-
if(!app().initialize<wallet_plugin, wallet_api_plugin, http_plugin>(argc, argv))
88-
return -1;
87+
if(!app().initialize<wallet_plugin, wallet_api_plugin, http_plugin>(argc, argv)) {
88+
const auto &opts = app().get_options();
89+
if (opts.count("help") || opts.count("version") || opts.count("full-version") ||
90+
opts.count("print-default-config")) {
91+
return 0;
92+
}
93+
}
8994
initialize_logging();
9095
auto& http = app().get_plugin<http_plugin>();
9196
http.add_handler("/v1/" + keosd::config::key_store_executable_name + "/stop", [&a=app()](string, string, url_response_callback cb) { cb(200, fc::variant(fc::variant_object())); a.quit(); } );

0 commit comments

Comments
 (0)