Delete Filesystem::CreateFolder.
BUG=webrtc:6424
Review-Url: https://codereview.webrtc.org/2891923002
Cr-Original-Commit-Position: refs/heads/master@{#19766}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 0677904e1b916594ab695a2282619cb3f207f03a
diff --git a/rtc_base/fileutils.h b/rtc_base/fileutils.h
index ba4b289..8c6f1e8 100644
--- a/rtc_base/fileutils.h
+++ b/rtc_base/fileutils.h
@@ -83,10 +83,6 @@
// non-existent file.
virtual bool DeleteFile(const Pathname &filename) = 0;
- // Creates a directory. This will call itself recursively to create /foo/bar
- // even if /foo does not exist. Returns true if the function succeeds.
- virtual bool CreateFolder(const Pathname &pathname) = 0;
-
// This moves a file from old_path to new_path, where "old_path" is a
// plain file. This DCHECKs and returns false if old_path points to a
// directory, and returns true if the function succeeds.
@@ -123,10 +119,6 @@
return cur;
}
- static bool CreateFolder(const Pathname &pathname) {
- return EnsureDefaultFilesystem()->CreateFolder(pathname);
- }
-
static bool DeleteFile(const Pathname &filename) {
return EnsureDefaultFilesystem()->DeleteFile(filename);
}
diff --git a/rtc_base/logging_unittest.cc b/rtc_base/logging_unittest.cc
index 28538bb..940b9c1 100644
--- a/rtc_base/logging_unittest.cc
+++ b/rtc_base/logging_unittest.cc
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/rtc_base/fileutils.h"
#include "webrtc/rtc_base/gunit.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/nullsocketserver.h"
diff --git a/rtc_base/unixfilesystem.cc b/rtc_base/unixfilesystem.cc
index 3a63e23..898fdd6 100644
--- a/rtc_base/unixfilesystem.cc
+++ b/rtc_base/unixfilesystem.cc
@@ -57,39 +57,6 @@
UnixFilesystem::~UnixFilesystem() {}
-bool UnixFilesystem::CreateFolder(const Pathname &path, mode_t mode) {
- std::string pathname(path.pathname());
- int len = pathname.length();
- if ((len == 0) || (pathname[len - 1] != '/'))
- return false;
-
- struct stat st;
- int res = ::stat(pathname.c_str(), &st);
- if (res == 0) {
- // Something exists at this location, check if it is a directory
- return S_ISDIR(st.st_mode) != 0;
- } else if (errno != ENOENT) {
- // Unexpected error
- return false;
- }
-
- // Directory doesn't exist, look up one directory level
- do {
- --len;
- } while ((len > 0) && (pathname[len - 1] != '/'));
-
- if (!CreateFolder(Pathname(pathname.substr(0, len)), mode)) {
- return false;
- }
-
- LOG(LS_INFO) << "Creating folder: " << pathname;
- return (0 == ::mkdir(pathname.c_str(), mode));
-}
-
-bool UnixFilesystem::CreateFolder(const Pathname &path) {
- return CreateFolder(path, 0755);
-}
-
bool UnixFilesystem::DeleteFile(const Pathname &filename) {
LOG(LS_INFO) << "Deleting file:" << filename.pathname();
diff --git a/rtc_base/unixfilesystem.h b/rtc_base/unixfilesystem.h
index 3c157cb..116df21 100644
--- a/rtc_base/unixfilesystem.h
+++ b/rtc_base/unixfilesystem.h
@@ -26,15 +26,6 @@
// It will fail with VERIY if you pass it a non-existant file, or a directory.
bool DeleteFile(const Pathname& filename) override;
- // Creates a directory. This will call itself recursively to create /foo/bar
- // even if /foo does not exist. All created directories are created with the
- // given mode.
- // Returns TRUE if function succeeds
- virtual bool CreateFolder(const Pathname &pathname, mode_t mode);
-
- // As above, with mode = 0755.
- bool CreateFolder(const Pathname& pathname) override;
-
// This moves a file from old_path to new_path, where "file" can be a plain
// file or directory, which will be moved recursively.
// Returns true if function succeeds.
diff --git a/rtc_base/win32filesystem.cc b/rtc_base/win32filesystem.cc
index 92ad70b..19122e5 100644
--- a/rtc_base/win32filesystem.cc
+++ b/rtc_base/win32filesystem.cc
@@ -33,36 +33,6 @@
namespace rtc {
-bool Win32Filesystem::CreateFolder(const Pathname &pathname) {
- if (pathname.pathname().empty() || !pathname.filename().empty())
- return false;
-
- std::wstring path16;
- if (!Utf8ToWindowsFilename(pathname.pathname(), &path16))
- return false;
-
- DWORD res = ::GetFileAttributes(path16.c_str());
- if (res != INVALID_FILE_ATTRIBUTES) {
- // Something exists at this location, check if it is a directory
- return ((res & FILE_ATTRIBUTE_DIRECTORY) != 0);
- } else if ((GetLastError() != ERROR_FILE_NOT_FOUND)
- && (GetLastError() != ERROR_PATH_NOT_FOUND)) {
- // Unexpected error
- return false;
- }
-
- // Directory doesn't exist, look up one directory level
- if (!pathname.parent_folder().empty()) {
- Pathname parent(pathname);
- parent.SetFolder(pathname.parent_folder());
- if (!CreateFolder(parent)) {
- return false;
- }
- }
-
- return (::CreateDirectory(path16.c_str(), nullptr) != 0);
-}
-
bool Win32Filesystem::DeleteFile(const Pathname &filename) {
LOG(LS_INFO) << "Deleting file " << filename.pathname();
if (!IsFile(filename)) {
diff --git a/rtc_base/win32filesystem.h b/rtc_base/win32filesystem.h
index 0fff15d..95c820c 100644
--- a/rtc_base/win32filesystem.h
+++ b/rtc_base/win32filesystem.h
@@ -21,11 +21,6 @@
// If the path points to a folder, it will fail with VERIFY
bool DeleteFile(const Pathname& filename) override;
- // Creates a directory. This will call itself recursively to create /foo/bar even if
- // /foo does not exist.
- // Returns TRUE if function succeeds
- bool CreateFolder(const Pathname& pathname) override;
-
// This moves a file from old_path to new_path. If the new path is on a
// different volume than the old, it will attempt to copy and then delete
// the folder