From 0ec05be303b3d6b64c041f7c1640eabeb55c899c Mon Sep 17 00:00:00 2001 From: Saturneric Date: Thu, 13 Jul 2023 18:19:04 +0800 Subject: feat: support all clear log and data files --- src/core/function/GlobalSettingStation.h | 34 +++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/core/function/GlobalSettingStation.h') diff --git a/src/core/function/GlobalSettingStation.h b/src/core/function/GlobalSettingStation.h index d70b3b63..aed99fa7 100644 --- a/src/core/function/GlobalSettingStation.h +++ b/src/core/function/GlobalSettingStation.h @@ -29,6 +29,10 @@ #ifndef GPGFRONTEND_GLOBALSETTINGSTATION_H #define GPGFRONTEND_GLOBALSETTINGSTATION_H +#include + +#include + #include "GpgFrontendBuildInstallInfo.h" #include "core/GpgFrontendCore.h" #include "core/GpgFunctionObject.h" @@ -151,6 +155,14 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation return app_resource_path_ / "certs"; } + [[nodiscard]] std::string GetLogFilesSize() const; + + [[nodiscard]] std::string GetDataObjectsFilesSize() const; + + void ClearAllLogFiles() const; + + void ClearAllDataObjects() const; + /** * @brief sync the settings to the file * @@ -166,7 +178,7 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation std::filesystem::path app_log_path_ = app_data_path_ / "logs"; ///< Program Data Location std::filesystem::path app_data_objs_path_ = - app_data_path_ / "objs"; ///< Object storage path + app_data_path_ / "data_objs"; ///< Object storage path #ifdef LINUX_INSTALL_BUILD std::filesystem::path app_resource_path_ = @@ -200,6 +212,26 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation * */ void init_app_secure_key(); + + /** + * @brief + * + */ + int64_t get_files_size_at_path(std::filesystem::path path, + std::string filename_pattern) const; + + /** + * @brief + * + */ + std::string get_human_readable_size(int64_t size) const; + + /** + * @brief + * + */ + void delete_all_files(std::filesystem::path path, + std::string filename_pattern) const; }; } // namespace GpgFrontend -- cgit v1.2.3