Commit a22cb202 authored by Kenton Varda's avatar Kenton Varda

Fix bug handling absolute source paths with no --src-prefix -- just output to…

Fix bug handling absolute source paths with no --src-prefix -- just output to the same directory in this case.
parent 9bcbd1cd
......@@ -268,6 +268,11 @@ public:
// Strip redundant "./" prefixes to make src-prefix matching more lenient.
while (file.startsWith("./")) {
file = file.slice(2);
// Remove redundant slashes as well (e.g. ".////foo" -> "foo").
while (file.startsWith("/")) {
file = file.slice(1);
}
}
if (!compilerConstructed) {
......
......@@ -1967,9 +1967,11 @@ private:
}
void writeFile(kj::StringPtr filename, const kj::StringTree& text) {
KJ_IF_MAYBE(slashpos, filename.findLast('/')) {
// Make the parent dir.
makeDirectory(kj::str(filename.slice(0, *slashpos)));
if (!filename.startsWith("/")) {
KJ_IF_MAYBE(slashpos, filename.findLast('/')) {
// Make the parent dir.
makeDirectory(kj::str(filename.slice(0, *slashpos)));
}
}
int fd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment