diff --git a/ICD.Common.Utils.Tests/PathUtilsTest.cs b/ICD.Common.Utils.Tests/PathUtilsTest.cs index 982334a..e827109 100644 --- a/ICD.Common.Utils.Tests/PathUtilsTest.cs +++ b/ICD.Common.Utils.Tests/PathUtilsTest.cs @@ -11,7 +11,49 @@ namespace ICD.Common.Utils.Tests [TestFixture] public sealed class PathUtilsTest { - [Test, UsedImplicitly] + #region Properties + + [Test] + public static void RootPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void NvramPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void ProgramConfigPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void CommonConfigPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void CommonLibPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void ProgramLibPathTest() + { + Assert.Inconclusive(); + } + + #endregion + + #region Methods + + [Test] public void JoinTest() { string expected = Path.Combine("A", "B"); @@ -19,5 +61,49 @@ namespace ICD.Common.Utils.Tests Assert.AreEqual(expected, PathUtils.Join("A", "B", "C")); } + + [Test] + public static void GetFullPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void ChangeFilenameWithoutExtTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void GetPathWithoutExtensionTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void RecurseFilePathsTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void GetDefaultConfigPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void GetProgramConfigPathTest() + { + Assert.Inconclusive(); + } + + [Test] + public static void PathExistsTest() + { + Assert.Inconclusive(); + } + + #endregion } } diff --git a/ICD.Common.Utils/PathUtils.cs b/ICD.Common.Utils/PathUtils.cs index 250a6a5..02b0806 100644 --- a/ICD.Common.Utils/PathUtils.cs +++ b/ICD.Common.Utils/PathUtils.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; using ICD.Common.Properties; -using ICD.Common.Services; -using ICD.Common.Services.Logging; using ICD.Common.Utils.IO; namespace ICD.Common.Utils @@ -125,41 +123,10 @@ namespace ICD.Common.Utils public static IEnumerable RecurseFilePaths(string path) { if (!IcdDirectory.Exists(path)) - yield break; + return Enumerable.Empty(); - Queue queue = new Queue(); - queue.Enqueue(path); - - while (queue.Count > 0) - { - path = queue.Dequeue(); - - // Get the subdirectories - try - { - foreach (string subDir in IcdDirectory.GetDirectories(path)) - queue.Enqueue(subDir); - } - catch (Exception e) - { - ServiceProvider.TryGetService().AddEntry(eSeverity.Error, e, e.Message); - } - - // Get the files - string[] files; - try - { - files = IcdDirectory.GetFiles(path); - } - catch (Exception e) - { - ServiceProvider.TryGetService().AddEntry(eSeverity.Error, e, e.Message); - continue; - } - - foreach (string filePath in files) - yield return filePath; - } + return RecursionUtils.BreadthFirstSearch(path, IcdDirectory.GetDirectories) + .SelectMany(p => IcdDirectory.GetFiles(p)); } /// @@ -168,6 +135,7 @@ namespace ICD.Common.Utils /// /// /// + [PublicAPI] public static string GetDefaultConfigPath(params string[] localPath) { string local = Join(localPath); @@ -199,6 +167,7 @@ namespace ICD.Common.Utils /// /// /// + [PublicAPI] public static bool PathExists(string path) { return IcdFile.Exists(path) || IcdDirectory.Exists(path);