I'm trying to do something like the following:
File inputfile;
foreach (string name; dirEntries(r".\subdir\", SpanMode.shallow))
{
if (!(isFile(name) && getExt(name) == "d"))
{
continue;
}
inputfile = File(name, "a+");
foreach (line; inputfile.byLine)
{
if (line == "import foo.d")
{
inputfile.write("import bar.d"); // or ideally `line = "import
bar.d"`
}
}
}
That obviously won't work. I think I might need to use the `fseek` function to
keep track of where I am in the file, or something like that. File I/O in D is
no fun..