Merge pull request #252 from timotheecour/fix_251
fix https://github.com/Hackerpilot/Dscanner/issues/251
This commit is contained in:
commit
780ecbe1e0
2
inifiled
2
inifiled
|
@ -1 +1 @@
|
||||||
Subproject commit 256db3c28db9e3824b7ed5f646964c19f37dd32d
|
Subproject commit 72393ec2e0711630ad93a15c66b0ea567b5b44df
|
18
src/main.d
18
src/main.d
|
@ -274,18 +274,32 @@ int run(string[] args)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string[] expandArgs(string[] args)
|
string[] expandArgs(string[] args)
|
||||||
{
|
{
|
||||||
|
// isFile can throw if it's a broken symlink.
|
||||||
|
bool isFileSafe(T)(T a)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return isFile(a);
|
||||||
|
}
|
||||||
|
catch(FileException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string[] rVal;
|
string[] rVal;
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
args ~= ".";
|
args ~= ".";
|
||||||
foreach (arg; args[1 ..$])
|
foreach (arg; args[1 ..$])
|
||||||
{
|
{
|
||||||
if (isFile(arg))
|
if (isFileSafe(arg))
|
||||||
rVal ~= arg;
|
rVal ~= arg;
|
||||||
else foreach (item; dirEntries(arg, SpanMode.breadth).map!(a => a.name))
|
else foreach (item; dirEntries(arg, SpanMode.breadth).map!(a => a.name))
|
||||||
{
|
{
|
||||||
if (isFile(item) && (item.endsWith(`.d`) || item.endsWith(`.di`)))
|
if (isFileSafe(item) && (item.endsWith(`.d`) || item.endsWith(`.di`)))
|
||||||
rVal ~= item;
|
rVal ~= item;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue