Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions create_dmd_release/build_all.d
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ struct Box
{
if (src.startsWith("default:"))
src = _tmpdir ~ "/" ~ src[8..$];
else if (src.startsWith("'default:"))
src = globExpand(_tmpdir, src[9..$-1]);
if (tgt.startsWith("default:"))
tgt = _tmpdir ~ "/" ~ tgt[8..$];
else if (tgt.startsWith("'default:"))
tgt = globExpand(_tmpdir, tgt[9..$-1]);

string[] srcs = split(src, " ");
foreach(s; srcs)
Expand All @@ -157,6 +161,25 @@ struct Box
}

private:
string globExpand(string basePath, string glob)
{
string[] paths = [basePath];

// For each pattern get the directory entries that match the pattern
foreach (pattern; glob.split(dirSeparator).filter!(n => n != ""))
{
string[] matches;
foreach (path; paths)
{
matches ~= dirEntries(path, pattern, SpanMode.shallow)
.map!(n => n.name)
.array;
}
paths = matches;
}
return paths.join(" ");
}

@property string vagrantFile()
{
auto res =
Expand Down