Skip to content

Commit 5ecd917

Browse files
committed
Substitute and glob expand quoted scp paths in NoVagrant mode
1 parent 194c9c8 commit 5ecd917

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

create_dmd_release/build_all.d

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,12 @@ struct Box
137137
{
138138
if (src.startsWith("default:"))
139139
src = _tmpdir ~ "/" ~ src[8..$];
140+
else if (src.startsWith("'default:"))
141+
src = globExpand(src[9..$-1]);
140142
if (tgt.startsWith("default:"))
141143
tgt = _tmpdir ~ "/" ~ tgt[8..$];
144+
else if (tgt.startsWith("'default:"))
145+
tgt = globExpand(tgt[9..$-1]);
142146

143147
string[] srcs = split(src, " ");
144148
foreach(s; srcs)
@@ -157,6 +161,32 @@ struct Box
157161
}
158162

159163
private:
164+
version(NoVagrant)
165+
string globExpand(string glob)
166+
{
167+
auto patterns = glob.split(dirSeparator).filter!(n => n != "").array;
168+
string[] paths = [_tmpdir];
169+
170+
// For each pattern get the directory entries that match the pattern
171+
while (patterns.length > 0)
172+
{
173+
string pattern = patterns[0];
174+
patterns = patterns[1 .. $];
175+
176+
string[] matches;
177+
foreach (path; paths)
178+
{
179+
foreach (entry; dirEntries(path, SpanMode.shallow).map!(n => n.name))
180+
{
181+
if (globMatch(baseName(entry), pattern))
182+
matches ~= entry;
183+
}
184+
}
185+
paths = matches;
186+
}
187+
return paths.join(" ");
188+
}
189+
160190
@property string vagrantFile()
161191
{
162192
auto res =

0 commit comments

Comments
 (0)