This commit is contained in:
2024-08-29 07:47:57 -05:00
parent e6bd5834f8
commit 0ea1cb544e
3 changed files with 14 additions and 38 deletions

View File

@ -542,10 +542,9 @@ auto app_config::load() -> bool {
static_cast<const char *>(__FUNCTION__),
};
auto ret = false;
auto ret{false};
const auto config_file_path = get_config_file_path();
std::cout << config_file_path << std::endl;
recur_mutex_lock lock(read_write_mutex_);
if (utils::file::file(config_file_path).exists()) {
try {

View File

@ -510,11 +510,6 @@ auto winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
std::uint64_t sds = descriptor_size == nullptr ? 0U : *descriptor_size;
auto ret = get_security_by_name(file_name, attributes, descriptor,
sds > 0U ? &sds : nullptr);
if (attributes != nullptr) {
event_system::instance().raise<debug_log>(
std::string{function_name}, api_path,
std::to_string(*attributes & FILE_ATTRIBUTE_DIRECTORY));
}
if (sds != 0U) {
*descriptor_size = static_cast<SIZE_T>(sds);
}
@ -713,8 +708,6 @@ auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
std::uint64_t handle{};
std::shared_ptr<i_open_file> file;
error = fm_->open(api_path, directory, ofd, handle, file);
event_system::instance().raise<debug_log>(
std::string{function_name}, api_path, std::to_string(handle));
if (error == api_error::success) {
api_meta_map meta;
error = provider_.get_item_meta(api_path, meta);
@ -905,7 +898,6 @@ auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
event_system::instance().raise<debug_log>(std::string{function_name}, "", "");
std::string api_path;
auto error = api_error::invalid_handle;

View File

@ -72,16 +72,9 @@ encrypt_provider::encrypt_provider(app_config &config) : config_(config) {}
auto encrypt_provider::create_api_file(
const std::string &api_path, bool directory,
const std::string &source_path) -> api_file {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
#if defined(_WIN32)
struct _stat64 buf {};
auto res = _stat64(source_path.c_str(), &buf);
event_system::instance().raise<debug_log>(
std::string{function_name}, source_path,
std::to_string(res) + ':' + std::to_string(directory));
_stat64(source_path.c_str(), &buf);
#else
struct stat buf {};
stat(source_path.c_str(), &buf);
@ -137,15 +130,9 @@ auto encrypt_provider::create_api_file(
void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
const api_file &file) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
#if defined(_WIN32)
struct _stat64 buf {};
auto res = _stat64(file.source_path.c_str(), &buf);
event_system::instance().raise<debug_log>(
std::string{function_name}, file.source_path, std::to_string(res));
_stat64(file.source_path.c_str(), &buf);
#else
struct stat buf {};
stat(file.source_path.c_str(), &buf);
@ -153,8 +140,17 @@ void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
meta[META_ACCESSED] = std::to_string(file.accessed_date);
#if defined(_WIN32)
meta[META_ATTRIBUTES] =
std::to_string(::GetFileAttributesA(file.source_path.c_str()));
meta[META_ATTRIBUTES] = std::to_string(
::GetFileAttributesA(file.source_path.c_str()) &
~(FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_TEMPORARY |
FILE_ATTRIBUTE_SPARSE_FILE | FILE_ATTRIBUTE_REPARSE_POINT |
FILE_ATTRIBUTE_COMPRESSED | FILE_ATTRIBUTE_OFFLINE |
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | FILE_ATTRIBUTE_ENCRYPTED |
FILE_ATTRIBUTE_INTEGRITY_STREAM | FILE_ATTRIBUTE_VIRTUAL |
FILE_ATTRIBUTE_NO_SCRUB_DATA | FILE_ATTRIBUTE_PINNED |
FILE_ATTRIBUTE_UNPINNED | FILE_ATTRIBUTE_RECALL_ON_OPEN |
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS));
#endif
#if defined(__APPLE__)
meta[META_BACKUP];
@ -453,8 +449,6 @@ auto encrypt_provider::get_file_list(api_file_list &list) const -> api_error {
try {
for (auto &&dir_entry : utils::file::directory{cfg.path}.get_items()) {
event_system::instance().raise<debug_log>(
std::string{function_name}, cfg.path, dir_entry->get_path());
std::string api_path{};
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
list.emplace_back(create_api_file(
@ -503,10 +497,6 @@ auto encrypt_provider::get_file_size(
auto encrypt_provider::get_filesystem_item(
const std::string &api_path, bool directory,
filesystem_item &fsi) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto result = db::db_select{*db_, source_table}
.column("source_path")
.where("api_path")
@ -519,9 +509,6 @@ auto encrypt_provider::get_filesystem_item(
auto source_path = row->get_column("source_path").get_value<std::string>();
event_system::instance().raise<debug_log>(
std::string{function_name}, source_path, std::to_string(directory));
if (directory) {
result = db::db_select{*db_, directory_table}
.column("api_path")
@ -635,8 +622,6 @@ auto encrypt_provider::get_item_meta(const std::string &api_path,
}
auto file = create_api_file(api_path, exists, source_path);
event_system::instance().raise<debug_log>(
std::string{function_name}, api_path, exists ? "true" : "false");
create_item_meta(meta, exists, file);
return api_error::success;
}