removed unnecessary is_file_writeable
This commit is contained in:
@@ -185,9 +185,6 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_used_drive_space() const -> std::uint64_t override;
|
||||
|
||||
[[nodiscard]] auto is_file_writeable(const std::string &api_path) const
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto is_read_only() const -> bool override { return false; }
|
||||
|
||||
[[nodiscard]] auto remove_directory(const std::string &api_path)
|
||||
|
@@ -178,9 +178,6 @@ public:
|
||||
[[nodiscard]] auto is_file(const std::string &api_path, bool &exists) const
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto is_file_writeable(const std::string &api_path) const
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto is_online() const -> bool override;
|
||||
|
||||
[[nodiscard]] auto is_read_only() const -> bool override { return true; }
|
||||
|
@@ -110,9 +110,6 @@ public:
|
||||
[[nodiscard]] virtual auto is_file(const std::string &api_path,
|
||||
bool &exists) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
is_file_writeable(const std::string &api_path) const -> bool = 0;
|
||||
|
||||
[[nodiscard]] virtual auto is_online() const -> bool = 0;
|
||||
|
||||
[[nodiscard]] virtual auto is_read_only() const -> bool = 0;
|
||||
|
@@ -160,8 +160,7 @@ auto fuse_drive::create_impl(std::string api_path, mode_t mode,
|
||||
return res;
|
||||
}
|
||||
|
||||
if ((is_write_only_op || is_read_write_op) &&
|
||||
not provider_.is_file_writeable(api_path)) {
|
||||
if ((is_write_only_op || is_read_write_op) && provider_.is_read_only()) {
|
||||
return api_error::permission_denied;
|
||||
}
|
||||
|
||||
@@ -1301,9 +1300,8 @@ auto fuse_drive::truncate_impl(std::string api_path, off_t size,
|
||||
#else
|
||||
auto fuse_drive::truncate_impl(std::string api_path, off_t size) -> api_error {
|
||||
#endif
|
||||
auto res = provider_.is_file_writeable(api_path)
|
||||
? api_error::success
|
||||
: api_error::permission_denied;
|
||||
auto res = provider_.is_read_only() ? api_error::permission_denied
|
||||
: api_error::success;
|
||||
if (res != api_error::success) {
|
||||
return res;
|
||||
}
|
||||
|
@@ -706,9 +706,8 @@ auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
|
||||
if (not directory &&
|
||||
(((granted_access & FILE_WRITE_DATA) == FILE_WRITE_DATA) ||
|
||||
((granted_access & GENERIC_WRITE) == GENERIC_WRITE))) {
|
||||
error = provider_.is_file_writeable(api_path)
|
||||
? api_error::success
|
||||
: api_error::permission_denied;
|
||||
error = provider_.is_read_only() ? api_error::permission_denied
|
||||
: api_error::success;
|
||||
}
|
||||
|
||||
if (error == api_error::success) {
|
||||
|
@@ -469,17 +469,6 @@ auto base_provider::get_used_drive_space() const -> std::uint64_t {
|
||||
return meta_db_->get_total_size();
|
||||
}
|
||||
|
||||
auto base_provider::is_file_writeable(const std::string &api_path) const
|
||||
-> bool {
|
||||
bool exists{};
|
||||
auto res = is_directory(api_path, exists);
|
||||
if (res != api_error::success) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return not exists;
|
||||
}
|
||||
|
||||
void base_provider::process_removed_directories(
|
||||
std::deque<removed_item> removed_list, stop_type &stop_requested) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
@@ -601,11 +601,6 @@ auto encrypt_provider::is_file(const std::string &api_path, bool &exists) const
|
||||
return api_error::error;
|
||||
}
|
||||
|
||||
auto encrypt_provider::is_file_writeable(const std::string & /*api_path*/) const
|
||||
-> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto encrypt_provider::is_online() const -> bool {
|
||||
return utils::file::directory{get_encrypt_config().path}.exists();
|
||||
}
|
||||
|
@@ -112,10 +112,6 @@ public:
|
||||
MOCK_METHOD(api_error, is_file, (const std::string &api_path, bool &exists),
|
||||
(const, override));
|
||||
|
||||
bool is_file_writeable(const std::string & /* api_path */) const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
MOCK_METHOD(bool, is_online, (), (const, override));
|
||||
|
||||
bool is_rename_supported() const override { return allow_rename_; }
|
||||
|
@@ -969,7 +969,6 @@ static void run_tests(const app_config &cfg, i_provider &provider) {
|
||||
get_used_drive_space(provider);
|
||||
is_directory(provider);
|
||||
is_file(provider);
|
||||
is_file_writeable(provider);
|
||||
read_file_bytes(provider);
|
||||
remove_directory(provider);
|
||||
remove_file(provider);
|
||||
|
Reference in New Issue
Block a user