summaryrefslogtreecommitdiffstats
path: root/src/msvc_helper-win32.cc
diff options
context:
space:
mode:
authorScott Graham <scottmg@chromium.org>2012-09-20 00:15:55 (GMT)
committerScott Graham <scottmg@chromium.org>2012-09-20 00:15:55 (GMT)
commit21046b4a3e153754ab8f632c0b65ec1c61f7b828 (patch)
treead3dc3b0af97b76c42579533f966b6f8fb783aa8 /src/msvc_helper-win32.cc
parente6c8bd91c22b64374aa7a1c84ae0a462f4fe2896 (diff)
downloadNinja-21046b4a3e153754ab8f632c0b65ec1c61f7b828.zip
Ninja-21046b4a3e153754ab8f632c0b65ec1c61f7b828.tar.gz
Ninja-21046b4a3e153754ab8f632c0b65ec1c61f7b828.tar.bz2
fix spaces in headers for -t msvc
Diffstat (limited to 'src/msvc_helper-win32.cc')
-rw-r--r--src/msvc_helper-win32.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/msvc_helper-win32.cc b/src/msvc_helper-win32.cc
index a9f34aa..e2a121d 100644
--- a/src/msvc_helper-win32.cc
+++ b/src/msvc_helper-win32.cc
@@ -28,6 +28,22 @@ bool EndsWith(const string& input, const string& needle) {
input.substr(input.size() - needle.size()) == needle);
}
+void Replace(string& in_out, const string& find, const string& replace) {
+ size_t start_pos = 0;
+ while ((start_pos = in_out.find(find, start_pos)) != std::string::npos) {
+ in_out.replace(start_pos, find.length(), replace);
+ start_pos += replace.length();
+ }
+}
+
+string Escape(const string& path) {
+ string result = path;
+ // TODO: very strange format, should we escape \ too?
+ //Replace(result, "\\", "\\\\");
+ Replace(result, " ", "\\ ");
+ return result;
+}
+
} // anonymous namespace
// static
@@ -162,3 +178,11 @@ int CLWrapper::Run(const string& command, string* extra_output) {
return exit_code;
}
+
+vector<string> CLWrapper::GetEscapedResult() {
+ vector<string> result;
+ for (set<string>::iterator i = includes_.begin(); i != includes_.end(); ++i) {
+ result.push_back(Escape(*i));
+ }
+ return result;
+}