Author: bryanduxbury
Date: Thu Apr 22 21:21:46 2010
New Revision: 937070
URL: http://svn.apache.org/viewvc?rev=937070&view=rev
Log:
THRIFT-611. Under Windows when compiling using MinGW, includes are incorrectly
resolved due to '/' <-> '\' havoc.
This patch ensures the proper slashes are used based on the platform.
Modified:
incubator/thrift/trunk/compiler/cpp/src/main.cc
Modified: incubator/thrift/trunk/compiler/cpp/src/main.cc
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/main.cc?rev=937070&r1=937069&r2=937070&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/main.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/main.cc Thu Apr 22 21:21:46 2010
@@ -191,6 +191,15 @@ char *saferealpath(const char *path, cha
CharLowerBuff(buf, len);
strcpy(resolved_path, buf);
}
+
+ // Replace backslashes with forward slashes so the
+ // rest of the code behaves correctly.
+ size_t resolved_len = strlen(resolved_path);
+ for (size_t i = 0; i < resolved_len; i++) {
+ if (resolved_path[i] == '\\') {
+ resolved_path[i] = '/';
+ }
+ }
return resolved_path;
#else
return realpath(path, resolved_path);