Merge pull request #800 from patha454/patch-1
Exclude `.git` from search paths.
This commit is contained in:
commit
f628524b9b
|
@ -84,7 +84,8 @@ string[] expandArgs(string[] args)
|
||||||
{
|
{
|
||||||
import std.file : isFile, FileException, dirEntries, SpanMode;
|
import std.file : isFile, FileException, dirEntries, SpanMode;
|
||||||
import std.algorithm.iteration : map;
|
import std.algorithm.iteration : map;
|
||||||
import std.algorithm.searching : endsWith;
|
import std.algorithm.searching : endsWith, canFind;
|
||||||
|
import std.path : dirSeparator;
|
||||||
|
|
||||||
// isFile can throw if it's a broken symlink.
|
// isFile can throw if it's a broken symlink.
|
||||||
bool isFileSafe(T)(T a)
|
bool isFileSafe(T)(T a)
|
||||||
|
@ -105,7 +106,7 @@ string[] expandArgs(string[] args)
|
||||||
else
|
else
|
||||||
foreach (item; dirEntries(arg, SpanMode.breadth).map!(a => a.name))
|
foreach (item; dirEntries(arg, SpanMode.breadth).map!(a => a.name))
|
||||||
{
|
{
|
||||||
if (isFileSafe(item) && (item.endsWith(`.d`) || item.endsWith(`.di`)))
|
if (isFileSafe(item) && (item.endsWith(`.d`) || item.endsWith(`.di`)) && !item.canFind(dirSeparator ~ '.'))
|
||||||
rVal ~= item;
|
rVal ~= item;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue