Support comments in sync_list file (#958)

* If sync_list contains a comment line, exclude this from sync_list processing
This commit is contained in:
abraunegg 2020-06-20 19:13:46 +10:00 committed by GitHub
parent 1c10effb9b
commit 93163051f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,11 +17,15 @@ final class SelectiveSync
void load(string filepath)
{
if (exists(filepath)) {
paths = File(filepath)
.byLine()
.map!(a => buildNormalizedPath(a))
.filter!(a => a.length > 0)
.array;
// open file as read only
auto file = File(filepath, "r");
auto range = file.byLine();
foreach (line; range) {
// Skip comments in file
if (line.length == 0 || line[0] == ';' || line[0] == '#') continue;
paths ~= buildNormalizedPath(line);
}
file.close();
}
}