aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cxx/link.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx
index 34dc8d9..3fbcc07 100644
--- a/build2/cxx/link.cxx
+++ b/build2/cxx/link.cxx
@@ -1040,9 +1040,25 @@ namespace build2
ofdstream os (pr.out_fd);
os.exceptions (ofdstream::badbit | ofdstream::failbit);
- // 1 is resource ID, 24 is RT_MANIFEST.
+ // 1 is resource ID, 24 is RT_MANIFEST. We also need to escape
+ // Windows path backslashes.
//
- os << "1 24 \"" << mf << "\"" << endl;
+ os << "1 24 \"";
+
+ const string& s (mf.string ());
+ for (size_t i (0), j;; i = j + 1)
+ {
+ j = s.find ('\\', i);
+ os.write (s.c_str () + i,
+ (j == string::npos ? s.size () : j) - i);
+
+ if (j == string::npos)
+ break;
+
+ os.write ("\\\\", 2);
+ }
+
+ os << "\"" << endl;
os.close ();
}