Compare commits
3 Commits
4b8ac300c8
...
a00e77d554
Author | SHA1 | Date | |
---|---|---|---|
a00e77d554 | |||
05d5bd9fe5 | |||
e14e7e96c7 |
@ -23,8 +23,7 @@
|
||||
#define INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
|
||||
|
||||
#include "comm/packet/client_pool.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "utils/common.hpp"
|
||||
|
||||
using namespace boost::asio;
|
||||
using boost::asio::ip::tcp;
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "platform/unix_platform.hpp"
|
||||
#include "platform/win32_platform.hpp"
|
||||
#include "utils/unix.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/windows.hpp"
|
||||
#include "utils/windows/windows_utils.hpp"
|
||||
|
||||
#endif // INCLUDE_PLATFORM_PLATFORM_HPP_
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define INCLUDE_UTILS_ERROR_UTILS_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/error.hpp"
|
||||
|
||||
namespace repertory::utils::error {
|
||||
void raise_error(std::string_view function, std::string_view msg);
|
||||
|
@ -22,10 +22,7 @@
|
||||
#ifndef INCLUDE_UTILS_UTILS_HPP_
|
||||
#define INCLUDE_UTILS_UTILS_HPP_
|
||||
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/windows/windows_utils.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
void calculate_allocation_size(bool directory, std::uint64_t file_size,
|
||||
|
@ -21,11 +21,11 @@
|
||||
*/
|
||||
#include "app_config.hpp"
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/startup_exception.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace {
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
|
@ -21,13 +21,12 @@
|
||||
*/
|
||||
#include "comm/packet/packet.hpp"
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/encrypt.hpp"
|
||||
#include "utils/encryption.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
namespace repertory {
|
||||
void packet::clear() {
|
||||
|
@ -21,9 +21,11 @@
|
||||
*/
|
||||
#include "comm/packet/packet_client.hpp"
|
||||
|
||||
#include "events/events.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/collection.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/timeout.hpp"
|
||||
#include "version.hpp"
|
||||
|
@ -24,10 +24,9 @@
|
||||
#include "comm/packet/packet.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
using std::thread;
|
||||
|
@ -23,12 +23,12 @@
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "file_manager/i_file_manager.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/time.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
|
@ -28,12 +28,11 @@
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "initialize.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "utils/collection.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
auto fuse_base::instance() -> fuse_base & {
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "drives/directory_cache.hpp"
|
||||
#include "drives/directory_iterator.hpp"
|
||||
#include "drives/eviction.hpp"
|
||||
#include "drives/fuse/events.hpp"
|
||||
#include "drives/fuse/remotefuse/remote_server.hpp"
|
||||
#include "events/consumers/console_consumer.hpp"
|
||||
#include "events/consumers/logging_consumer.hpp"
|
||||
@ -41,7 +40,6 @@
|
||||
#include "utils/base64.hpp"
|
||||
#include "utils/collection.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/polling.hpp"
|
||||
#include "utils/time.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
@ -58,15 +56,15 @@ api_error fuse_drive::chflags_impl(std::string api_path, uint32_t flags) {
|
||||
std::to_string(flags));
|
||||
});
|
||||
}
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto fuse_drive::chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info * /*file_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
auto fuse_drive::chmod_impl(std::string api_path, mode_t mode) -> api_error {
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
return check_and_perform(api_path, X_OK, [&](api_meta_map &) -> api_error {
|
||||
return provider_.set_item_meta(api_path, META_MODE, std::to_string(mode));
|
||||
});
|
||||
@ -167,9 +165,9 @@ auto fuse_drive::create_impl(std::string api_path, mode_t mode,
|
||||
const auto now = utils::time::get_file_time_now();
|
||||
#if defined(__APPLE__)
|
||||
const auto osx_flags = static_cast<std::uint32_t>(file_info->flags);
|
||||
#else
|
||||
#else // !defined(__APPLE__)
|
||||
const auto osx_flags = 0U;
|
||||
#endif
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
auto meta = create_meta_attributes(
|
||||
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now, now,
|
||||
|
@ -23,7 +23,9 @@
|
||||
|
||||
#include "drives/fuse/fuse_drive_base.hpp"
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "utils/common.hpp"
|
||||
|
||||
namespace repertory {
|
||||
auto fuse_drive_base::access_impl(std::string api_path, int mask) -> api_error {
|
||||
|
@ -24,20 +24,15 @@
|
||||
#include "drives/fuse/remotefuse/remote_server.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "comm/packet/client_pool.hpp"
|
||||
#include "comm/packet/packet.hpp"
|
||||
#include "comm/packet/packet_server.hpp"
|
||||
#include "drives/directory_iterator.hpp"
|
||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||
#include "drives/remote/remote_open_file_table.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/base64.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
@ -164,7 +159,7 @@ void remote_server::populate_stat(const struct stat64 &unix_st,
|
||||
(unix_st.st_ctimespec.tv_sec * NANOS_PER_SECOND);
|
||||
r_stat.st_mtimespec = unix_st.st_mtimespec.tv_nsec +
|
||||
(unix_st.st_mtimespec.tv_sec * NANOS_PER_SECOND);
|
||||
#else
|
||||
#else // !defined(__APPLE__)
|
||||
r_stat.st_flags = 0;
|
||||
|
||||
r_stat.st_atimespec = static_cast<remote::file_time>(
|
||||
@ -175,7 +170,7 @@ void remote_server::populate_stat(const struct stat64 &unix_st,
|
||||
unix_st.st_ctim.tv_nsec + (unix_st.st_ctim.tv_sec * NANOS_PER_SECOND));
|
||||
r_stat.st_mtimespec = static_cast<remote::file_time>(
|
||||
unix_st.st_mtim.tv_nsec + (unix_st.st_mtim.tv_sec * NANOS_PER_SECOND));
|
||||
#endif
|
||||
#endif // defined(__APPLE__)
|
||||
r_stat.st_blksize = static_cast<remote::block_size>(unix_st.st_blksize);
|
||||
r_stat.st_blocks = static_cast<remote::block_count>(unix_st.st_blocks);
|
||||
r_stat.st_gid = unix_st.st_gid;
|
||||
@ -450,10 +445,10 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
#if defined(__APPLE__)
|
||||
res = datasync ? fcntl(static_cast<native_handle>(handle), F_FULLFSYNC)
|
||||
: fsync(static_cast<native_handle>(handle));
|
||||
#else
|
||||
#else // !defined(__APPLE__)
|
||||
res = datasync ? fdatasync(static_cast<native_handle>(handle))
|
||||
: fsync(static_cast<native_handle>(handle));
|
||||
#endif
|
||||
#endif // defined(__APPLE__)
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : 0);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "file_manager/file_manager.hpp"
|
||||
|
||||
#include "file_manager/events.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/startup_exception.hpp"
|
||||
@ -29,7 +30,6 @@
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/time.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
|
@ -23,12 +23,12 @@
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "file_manager/events.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/encrypting_reader.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
|
@ -21,10 +21,10 @@
|
||||
*/
|
||||
#include "file_manager/file_manager.hpp"
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
using std::bind;
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "utils/error_utils.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/unix.hpp"
|
||||
|
||||
namespace repertory {
|
||||
lock_data::lock_data(const provider_type &pt, std::string unique_id /*= ""*/)
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "file_manager/i_file_manager.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/polling.hpp"
|
||||
|
@ -21,9 +21,9 @@
|
||||
*/
|
||||
#include "utils/native_file.hpp"
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
|
@ -22,13 +22,16 @@
|
||||
#include "test_common.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class config_test : public ::testing::Test {
|
||||
public:
|
||||
static console_consumer cs;
|
||||
|
||||
std::string s3_directory{
|
||||
utils::path::combine(get_test_dir(), {"config_test", "s3"})};
|
||||
|
||||
@ -36,6 +39,7 @@ public:
|
||||
utils::path::combine(get_test_dir(), {"config_test", "sia"})};
|
||||
|
||||
void SetUp() override {
|
||||
event_system::instance().start();
|
||||
ASSERT_TRUE(utils::file::delete_directory_recursively(
|
||||
utils::path::combine(get_test_dir(), {"config_test"})));
|
||||
}
|
||||
@ -43,6 +47,7 @@ public:
|
||||
void TearDown() override {
|
||||
ASSERT_TRUE(utils::file::delete_directory_recursively(
|
||||
utils::path::combine(get_test_dir(), {"config_test"})));
|
||||
event_system::instance().stop();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
#include "file_manager/file_manager.hpp"
|
||||
#include "mocks/mock_provider.hpp"
|
||||
#include "mocks/mock_upload_manager.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/unix/unix_utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
static constexpr const std::size_t test_chunk_size = 1024u;
|
||||
|
@ -21,7 +21,6 @@
|
||||
*/
|
||||
#include "test_common.hpp"
|
||||
|
||||
#include "drives/winfsp/i_winfsp_drive.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/remote_client.hpp"
|
||||
#include "events/consumers/console_consumer.hpp"
|
||||
#if defined(_WIN32)
|
||||
@ -31,9 +30,9 @@
|
||||
#include "drives/fuse/remotefuse/remote_server.hpp"
|
||||
#include "mocks/mock_fuse_drive.hpp"
|
||||
#endif
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/time.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "utils/common.hpp"
|
||||
|
||||
using namespace repertory;
|
||||
using namespace repertory::remote_winfsp;
|
||||
|
@ -21,8 +21,9 @@
|
||||
*/
|
||||
#include "test_common.hpp"
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#include "test_common.hpp"
|
||||
|
||||
#include "utils/utils.hpp"
|
||||
#include "utils/common.hpp"
|
||||
|
||||
namespace repertory {
|
||||
TEST(version, equal) {
|
||||
|
4
support/3rd_party/src/utils/file.cpp
vendored
4
support/3rd_party/src/utils/file.cpp
vendored
@ -254,6 +254,10 @@ auto read_json_file(std::string_view path, nlohmann::json &data) -> bool {
|
||||
|
||||
try {
|
||||
auto abs_path = utils::path::absolute(path);
|
||||
if (not is_file(abs_path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::ifstream file_stream{
|
||||
abs_path.c_str(),
|
||||
std::ios_base::binary | std::ios::in,
|
||||
|
Reference in New Issue
Block a user