diff --git a/source/dub/compilers/buildsettings.d b/source/dub/compilers/buildsettings.d index 52089b5..e752e80 100644 --- a/source/dub/compilers/buildsettings.d +++ b/source/dub/compilers/buildsettings.d @@ -89,7 +89,7 @@ void prependStringImportPaths(in string[] value...) { prepend(stringImportPaths, value); } void addImportFiles(in string[] value...) { add(importFiles, value); } void removeImportFiles(in string[] value...) { removePaths(importFiles, value); } - void addStringImportFiles(in string[] value...) { add(stringImportFiles, value); } + void addStringImportFiles(in string[] value...) { addSI(stringImportFiles, value); } void addPreGenerateCommands(in string[] value...) { add(preGenerateCommands, value, false); } void addPostGenerateCommands(in string[] value...) { add(postGenerateCommands, value, false); } void addPreBuildCommands(in string[] value...) { add(preBuildCommands, value, false); } @@ -135,6 +135,20 @@ } } + // add string import files (avoids file name duplicates in addition to path duplicates) + private void addSI(ref string[] arr, in string[] vals) + { + outer: + foreach (v; vals) { + auto vh = Path(v).head; + foreach (ve; arr) { + if (Path(ve).head == vh) + continue outer; + } + arr ~= v; + } + } + private void removePaths(ref string[] arr, in string[] vals) { bool matches(string s)