This commit is contained in:
parent
88436c9d1f
commit
086feaf7a5
@ -40,6 +40,7 @@
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/polling.hpp"
|
||||
#include "utils/time.hpp"
|
||||
#include <utils/unix.hpp>
|
||||
|
||||
namespace repertory {
|
||||
file_manager::file_manager(app_config &config, i_provider &provider)
|
||||
@ -375,6 +376,8 @@ auto file_manager::open(
|
||||
const std::string &api_path, bool directory, const open_file_data &ofd,
|
||||
std::uint64_t &handle, std::shared_ptr<i_open_file> &file,
|
||||
std::shared_ptr<i_closeable_open_file> closeable_file) -> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto create_and_add_handle =
|
||||
[&](std::shared_ptr<i_closeable_open_file> cur_file) {
|
||||
handle = get_next_handle();
|
||||
@ -437,6 +440,14 @@ auto file_manager::open(
|
||||
return download_type::direct;
|
||||
}
|
||||
|
||||
if (not utils::file::directory{buffer_directory}.create_directory()) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, fsi.api_path, utils::get_last_error_code(),
|
||||
fmt::format("failed to create buffer directory|sp|{}",
|
||||
buffer_directory));
|
||||
return download_type::direct;
|
||||
}
|
||||
|
||||
auto free_space = utils::file::get_free_drive_space(buffer_directory);
|
||||
if (config_.get_ring_buffer_file_size() < free_space) {
|
||||
return download_type::ring_buffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user