diff --git a/CMakeLists.txt b/CMakeLists.txt index 52e53ad..f1d1278 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ if(STATIC) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_RUNTIME ON) endif() -find_package(Boost 1.66 QUIET REQUIRED COMPONENTS program_options thread) +find_package(Boost 1.66 QUIET REQUIRED COMPONENTS filesystem program_options thread) list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 874bb5a..463c895 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -71,7 +71,7 @@ if (NOT ("${LWSF_POLYSEED_SOURCE}" STREQUAL "")) set(LWSF_POLYSEED_LIBRARY polyseed) endif() -target_compile_definitions(lwsf-api PRIVATE ${LWSF_COMPILE_DEFINITIONS}) +target_compile_definitions(lwsf-api PUBLIC ${LWSF_COMPILE_DEFINITIONS}) target_include_directories(lwsf-api PUBLIC "${lwsf_SOURCE_DIR}/include" @@ -88,6 +88,7 @@ target_link_libraries(lwsf-api lwsf-wire-json lwsf-wire-msgpack lwsf-wire-wrapper + ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${sodium_LIBRARY_RELEASE} ${LWSF_POLYSEED_LIBRARY} diff --git a/src/pending_transaction.cpp b/src/pending_transaction.cpp index 0edffb6..43a5d62 100644 --- a/src/pending_transaction.cpp +++ b/src/pending_transaction.cpp @@ -28,7 +28,7 @@ #include "pending_transaction.h" -#include +#include #include #include #include "backend.h" @@ -172,7 +172,7 @@ namespace lwsf { namespace internal if (filename.empty()) return send(); - if (std::filesystem::exists(filename) && !overwrite) + if (boost::filesystem::exists(filename) && !overwrite) { error_ = "File already exists"; return false; diff --git a/src/wallet.cpp b/src/wallet.cpp index 7e63638..e6b0da7 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -33,9 +33,9 @@ #endif #include +#include #include #include -#include #include #include #include @@ -181,7 +181,7 @@ namespace lwsf { namespace internal } #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) - bool atomic_file_write(const std::filesystem::path& filename, const std::filesystem::path& directory, epee::byte_slice contents) noexcept + bool atomic_file_write(const boost::filesystem::path& filename, const boost::filesystem::path& directory, epee::byte_slice contents) noexcept { const int fd = open(filename.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); @@ -387,14 +387,14 @@ namespace lwsf { namespace internal std::vector wallet::find(const std::string& path) { std::vector out; - std::filesystem::path work_dir(path); - if(!std::filesystem::is_directory(path)) + boost::filesystem::path work_dir(path); + if(!boost::filesystem::is_directory(path)) return out; - std::filesystem::recursive_directory_iterator end_itr; - for (std::filesystem::recursive_directory_iterator itr(path); itr != end_itr; ++itr) + boost::filesystem::recursive_directory_iterator end_itr; + for (boost::filesystem::recursive_directory_iterator itr(path); itr != end_itr; ++itr) { - if (std::filesystem::is_regular_file(itr->status())) + if (boost::filesystem::is_regular_file(itr->status())) { std::string filename = itr->path().filename().string(); if (!try_load(filename, wallet_file_magic).empty()) @@ -753,13 +753,13 @@ namespace lwsf { namespace internal try { - const std::filesystem::path file = real_path; - const std::filesystem::path new_file = real_path + ".new"; - const std::filesystem::path directory = - std::filesystem::path{real_path}.remove_filename(); + const boost::filesystem::path file = real_path; + const boost::filesystem::path new_file = real_path + ".new"; + const boost::filesystem::path directory = + boost::filesystem::path{real_path}.remove_filename(); - if (std::filesystem::exists(new_file)) - std::filesystem::rename(new_file, file); + if (boost::filesystem::exists(new_file)) + boost::filesystem::rename(new_file, file); // blocks until file and directory contents are synced epee::byte_slice blob = @@ -767,7 +767,7 @@ namespace lwsf { namespace internal if (!atomic_file_write(new_file, directory, std::move(blob))) throw std::runtime_error{"Failed to write file " + real_path}; - std::filesystem::rename(new_file, file); + boost::filesystem::rename(new_file, file); } catch (const std::exception& e) { @@ -816,7 +816,7 @@ namespace lwsf { namespace internal // Configure SSL certificate verification if (options.support != epee::net_utils::ssl_support_t::e_ssl_support_disabled) { - bool ca_file_valid = !ca_file_path_.empty() && std::filesystem::exists(ca_file_path_); + bool ca_file_valid = !ca_file_path_.empty() && boost::filesystem::exists(ca_file_path_); if (ca_file_valid) { try {