Skip to content

Commit

Permalink
Remove unused iterateDirectory(string)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Geod24 committed Dec 17, 2023
1 parent afaf10a commit 7d80fc7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion source/dub/commandline.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/dub/generators/generator.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions source/dub/internal/vibecompat/core/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7d80fc7

Please sign in to comment.