Skip to content

Commit

Permalink
Substitute and glob expand quoted scp paths in NoVagrant mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jun 8, 2022
1 parent 194c9c8 commit 4f09ac9
Showing 1 changed file with 23 additions and 0 deletions.
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

0 comments on commit 4f09ac9

Please sign in to comment.