aboutsummaryrefslogtreecommitdiff
path: root/src/common/tests/file_utils.cc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2020-09-07 17:29:40 -0400
committerMike Frysinger <vapier@chromium.org>2020-09-07 23:03:28 +0000
commit5640e57f1f28472efdce2add14fd169b7e273037 (patch)
tree984fdd42f6a1dd98ef24ebaff420564c6ea01b00 /src/common/tests/file_utils.cc
parentlinux: Fix leak when the offset of memory_mapped_file is greater than 0 (diff)
downloadbreakpad-5640e57f1f28472efdce2add14fd169b7e273037.tar.xz
CopyFile: add a C++ API
Having to swizzle to C strings all the time is a bit annoying. Change-Id: I0b80877706e32e873e567685f6b471745da70311 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2396557 Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/common/tests/file_utils.cc')
-rw-r--r--src/common/tests/file_utils.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/tests/file_utils.cc b/src/common/tests/file_utils.cc
index 1c041777..c1cbb39c 100644
--- a/src/common/tests/file_utils.cc
+++ b/src/common/tests/file_utils.cc
@@ -96,6 +96,10 @@ bool CopyFile(const char* from_path, const char* to_path) {
return result;
}
+bool CopyFile(const std::string& from_path, const std::string& to_path) {
+ return CopyFile(from_path.c_str(), to_path.c_str());
+}
+
bool ReadFile(const char* path, void* buffer, ssize_t* buffer_size) {
int fd = HANDLE_EINTR(open(path, O_RDONLY));
if (fd == -1) {