Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(778)

Unified Diff: webrtc/base/unixfilesystem.cc

Issue 2747373003: Delete FilesystemInterface::CopyFile. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/unixfilesystem.h ('k') | webrtc/base/win32filesystem.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/unixfilesystem.cc
diff --git a/webrtc/base/unixfilesystem.cc b/webrtc/base/unixfilesystem.cc
index d0da7098104e59e8c2704a47ee0622b003b6f6ba..557c478774db6d38490f9e0de81c3ef7b9a75504 100644
--- a/webrtc/base/unixfilesystem.cc
+++ b/webrtc/base/unixfilesystem.cc
@@ -204,12 +204,7 @@ bool UnixFilesystem::MoveFile(const Pathname &old_path,
LOG(LS_VERBOSE) << "Moving " << old_path.pathname()
<< " to " << new_path.pathname();
if (rename(old_path.pathname().c_str(), new_path.pathname().c_str()) != 0) {
- if (errno != EXDEV)
- return false;
- if (!CopyFile(old_path, new_path))
- return false;
- if (!DeleteFile(old_path))
- return false;
+ return false;
}
return true;
}
@@ -221,31 +216,6 @@ bool UnixFilesystem::IsFolder(const Pathname &path) {
return S_ISDIR(st.st_mode);
}
-bool UnixFilesystem::CopyFile(const Pathname &old_path,
- const Pathname &new_path) {
- LOG(LS_VERBOSE) << "Copying " << old_path.pathname()
- << " to " << new_path.pathname();
- char buf[256];
- size_t len;
-
- StreamInterface *source = OpenFile(old_path, "rb");
- if (!source)
- return false;
-
- StreamInterface *dest = OpenFile(new_path, "wb");
- if (!dest) {
- delete source;
- return false;
- }
-
- while (source->Read(buf, sizeof(buf), &len, nullptr) == SR_SUCCESS)
- dest->Write(buf, len, nullptr, nullptr);
-
- delete source;
- delete dest;
- return true;
-}
-
bool UnixFilesystem::IsTemporaryPath(const Pathname& pathname) {
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC)
RTC_DCHECK(provided_app_temp_folder_ != nullptr);
« no previous file with comments | « webrtc/base/unixfilesystem.h ('k') | webrtc/base/win32filesystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698