From 12a32ba4413ed2bea23e499c34408fea41182346 Mon Sep 17 00:00:00 2001 From: wuyangfan <1102042793@qq.com> Date: Mon, 18 May 2026 00:49:39 +0800 Subject: [PATCH 1/2] refactor: rename FileHelpers.DeleteAll to DeleteFiles Clarifies that the API removes files matching a pattern, not arbitrary resources. Fixes #53 --- cpp/Platform.IO/FileHelpers.h | 6 +++--- csharp/Platform.IO/FileHelpers.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/Platform.IO/FileHelpers.h b/cpp/Platform.IO/FileHelpers.h index e9401ba..e8f7633 100644 --- a/cpp/Platform.IO/FileHelpers.h +++ b/cpp/Platform.IO/FileHelpers.h @@ -69,11 +69,11 @@ } } - public: static void DeleteAll(std::string directory) { DeleteAll(directory, "*"); } + public: static void DeleteFiles(std::string directory) { DeleteFiles(directory, "*"); } - public: static void DeleteAll(std::string directory, std::string searchPattern) { DeleteAll(directory, searchPattern, SearchOption.TopDirectoryOnly); } + public: static void DeleteFiles(std::string directory, std::string searchPattern) { DeleteFiles(directory, searchPattern, SearchOption.TopDirectoryOnly); } - public: static void DeleteAll(std::string directory, std::string searchPattern, SearchOption searchOption) + public: static void DeleteFiles(std::string directory, std::string searchPattern, SearchOption searchOption) { foreach (auto file in Directory.EnumerateFiles(directory, searchPattern, searchOption)) { diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index fd412a3..5217c98 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -207,7 +207,7 @@ public static void SetSize(string path, long size) /// Путь к директории для очистки. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeleteAll(string directory) => DeleteAll(directory, "*"); + public static void DeleteFiles(string directory) => DeleteFiles(directory, "*"); /// /// Removes files from the directory at the path according to the . @@ -222,7 +222,7 @@ public static void SetSize(string path, long size) /// Шаблон поиска для удаляемых файлов в директории находящейся по пути . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeleteAll(string directory, string searchPattern) => DeleteAll(directory, searchPattern, SearchOption.TopDirectoryOnly); + public static void DeleteFiles(string directory, string searchPattern) => DeleteFiles(directory, searchPattern, SearchOption.TopDirectoryOnly); /// /// Removes files from the directory at the path according to the and the . @@ -241,7 +241,7 @@ public static void SetSize(string path, long size) /// Значение определяющее искать ли только в текущей директории находящейся по пути , или также во всех субдиректориях. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeleteAll(string directory, string searchPattern, SearchOption searchOption) + public static void DeleteFiles(string directory, string searchPattern, SearchOption searchOption) { foreach (var file in Directory.EnumerateFiles(directory, searchPattern, searchOption)) { From 9cc4f0ee1a3e661cda2def4f33276dd05d5c9b34 Mon Sep 17 00:00:00 2001 From: wuyangfan <1102042793@qq.com> Date: Mon, 18 May 2026 00:53:25 +0800 Subject: [PATCH 2/2] refactor: rename DeleteFiles directory parameter to path Aligns with .NET Directory.EnumerateFiles naming and simplifies XML docs. Fixes #52 --- cpp/Platform.IO/FileHelpers.h | 8 +++---- csharp/Platform.IO/FileHelpers.cs | 38 +++++++++++++++---------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cpp/Platform.IO/FileHelpers.h b/cpp/Platform.IO/FileHelpers.h index e8f7633..ce7e167 100644 --- a/cpp/Platform.IO/FileHelpers.h +++ b/cpp/Platform.IO/FileHelpers.h @@ -69,13 +69,13 @@ } } - public: static void DeleteFiles(std::string directory) { DeleteFiles(directory, "*"); } + public: static void DeleteFiles(std::string path) { DeleteFiles(path, "*"); } - public: static void DeleteFiles(std::string directory, std::string searchPattern) { DeleteFiles(directory, searchPattern, SearchOption.TopDirectoryOnly); } + public: static void DeleteFiles(std::string path, std::string searchPattern) { DeleteFiles(path, searchPattern, SearchOption.TopDirectoryOnly); } - public: static void DeleteFiles(std::string directory, std::string searchPattern, SearchOption searchOption) + public: static void DeleteFiles(std::string path, std::string searchPattern, SearchOption searchOption) { - foreach (auto file in Directory.EnumerateFiles(directory, searchPattern, searchOption)) + foreach (auto file in Directory.EnumerateFiles(path, searchPattern, searchOption)) { File.Delete(file); } diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 5217c98..bf7e77b 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -199,51 +199,51 @@ public static void SetSize(string path, long size) } /// - /// Removes all files from the directory at the path . - /// Удаляет все файлы из директории находящейся по пути . + /// Removes all files from the directory at . + /// Удаляет все файлы из директории по пути . /// - /// + /// /// The path to the directory to be cleaned. /// Путь к директории для очистки. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeleteFiles(string directory) => DeleteFiles(directory, "*"); + public static void DeleteFiles(string path) => DeleteFiles(path, "*"); /// - /// Removes files from the directory at the path according to the . - /// Удаляет файлы из директории находящейся по пути в соотвествии с . + /// Removes files from the directory at according to . + /// Удаляет файлы из директории по пути в соответствии с . /// - /// + /// /// The path to the directory to be cleaned. /// Путь к директории для очистки. /// /// - /// The search pattern for files to be deleted in the directory at the path . - /// Шаблон поиска для удаляемых файлов в директории находящейся по пути . + /// The search pattern for files to be deleted. + /// Шаблон поиска для удаляемых файлов. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeleteFiles(string directory, string searchPattern) => DeleteFiles(directory, searchPattern, SearchOption.TopDirectoryOnly); + public static void DeleteFiles(string path, string searchPattern) => DeleteFiles(path, searchPattern, SearchOption.TopDirectoryOnly); /// - /// Removes files from the directory at the path according to the and the . - /// Удаляет файлы из директории находящейся по пути в соотвествии с и . + /// Removes files from the directory at according to and . + /// Удаляет файлы из директории по пути в соответствии с и . /// - /// + /// /// The path to the directory to be cleaned. /// Путь к директории для очистки. /// /// - /// The search pattern for files to be deleted in the directory at the path . - /// Шаблон поиска для удаляемых файлов в директории находящейся по пути . + /// The search pattern for files to be deleted. + /// Шаблон поиска для удаляемых файлов. /// /// - /// The value that determines whether to search only in the current the directory at the path , or also in all subdirectories. - /// Значение определяющее искать ли только в текущей директории находящейся по пути , или также во всех субдиректориях. + /// Whether to search only the current directory or all subdirectories. + /// Искать ли только в текущей директории или также во всех поддиректориях. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeleteFiles(string directory, string searchPattern, SearchOption searchOption) + public static void DeleteFiles(string path, string searchPattern, SearchOption searchOption) { - foreach (var file in Directory.EnumerateFiles(directory, searchPattern, searchOption)) + foreach (var file in Directory.EnumerateFiles(path, searchPattern, searchOption)) { File.Delete(file); }