aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/utils/FilesystemUtils.h
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-11-07 07:18:06 +0000
committersaturneric <[email protected]>2023-11-07 07:18:06 +0000
commit3ad7fecdb6458fdd6f146bed19fe643c7f93e905 (patch)
tree522f7a5dd0389ad0771d01a50ea49ef646940894 /src/core/utils/FilesystemUtils.h
parentrefactor: improve the code structure of core (diff)
downloadGpgFrontend-3ad7fecdb6458fdd6f146bed19fe643c7f93e905.tar.gz
GpgFrontend-3ad7fecdb6458fdd6f146bed19fe643c7f93e905.zip
refactor: remove CommonUtils at core
Diffstat (limited to 'src/core/utils/FilesystemUtils.h')
-rw-r--r--src/core/utils/FilesystemUtils.h39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/core/utils/FilesystemUtils.h b/src/core/utils/FilesystemUtils.h
index 23b73b2b..e38078a5 100644
--- a/src/core/utils/FilesystemUtils.h
+++ b/src/core/utils/FilesystemUtils.h
@@ -28,13 +28,16 @@
#pragma once
+namespace GpgFrontend {
+
/**
* @brief Get the file extension object
*
* @param path
* @return std::string
*/
-auto GetFileExtension(const std::string& path) -> std::string;
+auto GPGFRONTEND_CORE_EXPORT GetFileExtension(const std::string& path)
+ -> std::string;
/**
* @brief Get the only file name with path object
@@ -42,4 +45,36 @@ auto GetFileExtension(const std::string& path) -> std::string;
* @param path
* @return std::string
*/
-auto GetOnlyFileNameWithPath(const std::string& path) -> std::string; \ No newline at end of file
+auto GPGFRONTEND_CORE_EXPORT GetOnlyFileNameWithPath(const std::string& path)
+ -> std::string;
+
+/**
+ * @brief Get the File Size By Path object
+ *
+ * @param path The path of the file
+ * @param filename_pattern The pattern of the file name, e.g. "*.txt"
+ * @return int64_t
+ */
+auto GPGFRONTEND_CORE_EXPORT GetFileSizeByPath(
+ const std::filesystem::path& path, const std::string& filename_pattern)
+ -> int64_t;
+
+/**
+ * @brief Get the Human Readable File Size object
+ *
+ * @param size
+ * @return std::string
+ */
+auto GPGFRONTEND_CORE_EXPORT GetHumanFriendlyFileSize(int64_t size)
+ -> std::string;
+
+/**
+ * @brief
+ *
+ * @param path
+ * @param filename_pattern
+ */
+void GPGFRONTEND_CORE_EXPORT DeleteAllFilesByPattern(
+ const std::filesystem::path& path, const std::string& filename_pattern);
+
+} // namespace GpgFrontend \ No newline at end of file