From 2ce86e1498ad1b17edfb7e1c955930b237fb0694 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 24 Dec 2024 21:34:40 -0600 Subject: [PATCH] refactor --- .../librepertory/src/file_manager/open_file.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/repertory/librepertory/src/file_manager/open_file.cpp b/repertory/librepertory/src/file_manager/open_file.cpp index 0d0fc373..720f6c81 100644 --- a/repertory/librepertory/src/file_manager/open_file.cpp +++ b/repertory/librepertory/src/file_manager/open_file.cpp @@ -197,17 +197,8 @@ auto open_file::close() -> bool { return true; } - if (allocated) { - file_manager::remove_source_and_shrink_cache( - fsi_.api_path, fsi_.source_path, fsi_.size, allocated); - } else { - auto file = utils::file::file{fsi_.source_path}; - if (not file.remove()) { - utils::error::raise_api_path_error( - function_name, fsi_.api_path, fsi_.source_path, - utils::get_last_error_code(), "failed to delete source file"); - } - } + file_manager::remove_source_and_shrink_cache(fsi_.api_path, fsi_.source_path, + fsi_.size, allocated); auto parent = utils::path::get_parent_path(fsi_.source_path); fsi_.source_path =