From 5914ce7a160a82db1490e99c45c95c69417b20ea Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 3 Feb 2015 21:35:50 -0800 Subject: 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 : \\\n ... This cl is based on https://github.com/google/protobuf/pull/178 --- src/google/protobuf/testing/file.cc | 4 ++++ src/google/protobuf/testing/file.h | 3 +++ 2 files changed, 7 insertions(+) (limited to 'src/google/protobuf/testing') 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); -- cgit v1.2.3