aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/testing
diff options
context:
space:
mode:
authorGravatar Bo Yang <paulyang1211@gmail.com>2015-02-03 21:35:50 -0800
committerGravatar Bo Yang <paulyang1211@gmail.com>2015-02-03 21:35:50 -0800
commit5914ce7a160a82db1490e99c45c95c69417b20ea (patch)
treefdd9219543de9caf2490a1bcc10ef62ffe27d254 /src/google/protobuf/testing
parent532c94145b6605361513682601f1d8e9f97a2497 (diff)
Implement a feature to generate a dependency file. By giving protoc the flag
"--dependency_manifest_out=FILE", protoc will write dependencies of input proto files into FILE. In FILE, the format will be <full path to FILE>: <full path to 1st proto>\\\n <full path to 2nd proto> ... This cl is based on https://github.com/google/protobuf/pull/178
Diffstat (limited to 'src/google/protobuf/testing')
-rw-r--r--src/google/protobuf/testing/file.cc4
-rw-r--r--src/google/protobuf/testing/file.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/google/protobuf/testing/file.cc b/src/google/protobuf/testing/file.cc
index 5344ec15..3d07b127 100644
--- a/src/google/protobuf/testing/file.cc
+++ b/src/google/protobuf/testing/file.cc
@@ -192,5 +192,9 @@ void File::DeleteRecursively(const string& name,
#endif
}
+bool File::ChangeWorkingDirectory(const string& new_working_directory) {
+ return chdir(new_working_directory.c_str()) == 0;
+}
+
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/testing/file.h b/src/google/protobuf/testing/file.h
index d2aeabf2..2f63f80e 100644
--- a/src/google/protobuf/testing/file.h
+++ b/src/google/protobuf/testing/file.h
@@ -77,6 +77,9 @@ class File {
static void DeleteRecursively(const string& name,
void* dummy1, void* dummy2);
+ // Change working directory to given directory.
+ static bool ChangeWorkingDirectory(const string& new_working_directory);
+
static bool GetContents(
const string& name, string* output, bool /*is_default*/) {
return ReadFileToString(name, output);