From 7d80fc7c04f0fb2d8a3abd2839d56cb7394484cf Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Sun, 17 Dec 2023 21:12:01 +0100 Subject: [PATCH] Remove unused iterateDirectory(string) It was actually unused, because al the call sites were doing a useless round-trip from NativePath to string to NativePath. There is no need for it anymore so we can just remove it to avoid this kind of mistakes in the future. --- source/dub/commandline.d | 2 +- source/dub/generators/generator.d | 2 +- source/dub/internal/vibecompat/core/file.d | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/source/dub/commandline.d b/source/dub/commandline.d index d3367cb62..6c1edecb4 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -2677,7 +2677,7 @@ class DustmiteCommand : PackageBuildCommand { void copyFolderRec(NativePath folder, NativePath dstfolder) { ensureDirectory(dstfolder); - foreach (de; iterateDirectory(folder.toNativeString())) { + foreach (de; iterateDirectory(folder)) { if (de.name.startsWith(".")) continue; if (de.isDirectory) { copyFolderRec(folder ~ de.name, dstfolder ~ de.name); diff --git a/source/dub/generators/generator.d b/source/dub/generators/generator.d index b602142c1..88d719ef6 100644 --- a/source/dub/generators/generator.d +++ b/source/dub/generators/generator.d @@ -1022,7 +1022,7 @@ private void finalizeGeneration(in Package pack, in Project proj, in GeneratorSe void copyFolderRec(NativePath folder, NativePath dstfolder) { ensureDirectory(dstfolder); - foreach (de; iterateDirectory(folder.toNativeString())) { + foreach (de; iterateDirectory(folder)) { if (de.isDirectory) { copyFolderRec(folder ~ de.name, dstfolder ~ de.name); } else { diff --git a/source/dub/internal/vibecompat/core/file.d b/source/dub/internal/vibecompat/core/file.d index 6de924160..c4cbbe286 100644 --- a/source/dub/internal/vibecompat/core/file.d +++ b/source/dub/internal/vibecompat/core/file.d @@ -277,12 +277,6 @@ int delegate(scope int delegate(ref FileInfo)) iterateDirectory(NativePath path) } return &iterator; } -/// ditto -int delegate(scope int delegate(ref FileInfo)) iterateDirectory(string path) -{ - return iterateDirectory(NativePath(path)); -} - /** Returns the current working directory.