mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Replaced boost filesystem operations with linux system calls (#125)
* Replaced boost filesystem operations with linux syscalls * Removed boost filesystem dependency from CMAKE
This commit is contained in:
17
src/conf.cpp
17
src/conf.cpp
@@ -68,16 +68,16 @@ namespace conf
|
||||
*/
|
||||
int create_contract()
|
||||
{
|
||||
if (boost::filesystem::exists(ctx.contract_dir))
|
||||
if (util::is_dir_exists(ctx.contract_dir))
|
||||
{
|
||||
std::cout << "Contract dir already exists. Cannot create contract at the same location.\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
boost::filesystem::create_directories(ctx.config_dir);
|
||||
boost::filesystem::create_directories(ctx.hist_dir);
|
||||
boost::filesystem::create_directories(ctx.state_rw_dir);
|
||||
boost::filesystem::create_directories(ctx.log_dir);
|
||||
// Recursivly create contract directories.
|
||||
util::create_dir_tree_recursive(ctx.config_dir);
|
||||
util::create_dir_tree_recursive(ctx.hist_dir);
|
||||
util::create_dir_tree_recursive(ctx.state_rw_dir);
|
||||
|
||||
//Create config file with default settings.
|
||||
|
||||
@@ -134,8 +134,11 @@ namespace conf
|
||||
|
||||
// resolving the path through realpath will remove any trailing slash if present
|
||||
basedir = util::realpath(basedir);
|
||||
exepath = util::realpath(exepath);
|
||||
|
||||
// Take the parent directory path.
|
||||
ctx.exe_dir = dirname(exepath.data());
|
||||
|
||||
ctx.exe_dir = boost::filesystem::path(util::realpath(exepath)).parent_path().string();
|
||||
ctx.websocketd_exe_path = ctx.exe_dir + "/" + "websocketd";
|
||||
ctx.websocat_exe_path = ctx.exe_dir + "/" + "websocat";
|
||||
ctx.hpfs_exe_path = ctx.exe_dir + "/" + "hpfs";
|
||||
@@ -507,7 +510,7 @@ namespace conf
|
||||
|
||||
for (const std::string &path : paths)
|
||||
{
|
||||
if (!boost::filesystem::exists(path))
|
||||
if (!util::is_file_exists(path) && !util::is_dir_exists(path))
|
||||
{
|
||||
if (path == ctx.tls_key_file || path == ctx.tls_cert_file)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user