diff --git a/webrtc/base/fileutils.h b/webrtc/base/fileutils.h index f2669281bd..4e322f0d43 100644 --- a/webrtc/base/fileutils.h +++ b/webrtc/base/fileutils.h @@ -85,12 +85,6 @@ class FilesystemInterface { // non-existent file. virtual bool DeleteFile(const Pathname &filename) = 0; - // This will attempt to delete the empty folder located at 'folder' - // It DCHECKs and returns false if the path points to a file or a non-existent - // folder. It fails normally if the folder is not empty or can otherwise - // not be deleted. - virtual bool DeleteEmptyFolder(const Pathname &folder) = 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; diff --git a/webrtc/base/unixfilesystem.cc b/webrtc/base/unixfilesystem.cc index bfecf1a6a0..d106bbd933 100644 --- a/webrtc/base/unixfilesystem.cc +++ b/webrtc/base/unixfilesystem.cc @@ -133,17 +133,6 @@ bool UnixFilesystem::DeleteFile(const Pathname &filename) { return ::unlink(filename.pathname().c_str()) == 0; } -bool UnixFilesystem::DeleteEmptyFolder(const Pathname &folder) { - LOG(LS_INFO) << "Deleting folder" << folder.pathname(); - - if (!IsFolder(folder)) { - RTC_DCHECK(IsFolder(folder)); - return false; - } - std::string no_slash(folder.pathname(), 0, folder.pathname().length()-1); - return ::rmdir(no_slash.c_str()) == 0; -} - bool UnixFilesystem::GetTemporaryFolder(Pathname &pathname, bool create, const std::string *append) { #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) diff --git a/webrtc/base/unixfilesystem.h b/webrtc/base/unixfilesystem.h index 7d4859a7a5..457cbcaff6 100644 --- a/webrtc/base/unixfilesystem.h +++ b/webrtc/base/unixfilesystem.h @@ -38,11 +38,6 @@ class UnixFilesystem : public FilesystemInterface { // It will fail with VERIY if you pass it a non-existant file, or a directory. bool DeleteFile(const Pathname& filename) override; - // This will attempt to delete the folder located at 'folder' - // It DCHECKs and returns false if you pass it a non-existant folder or a - // plain file. - bool DeleteEmptyFolder(const Pathname& folder) 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. diff --git a/webrtc/base/win32filesystem.cc b/webrtc/base/win32filesystem.cc index feb7da0c78..9a075c1e9e 100644 --- a/webrtc/base/win32filesystem.cc +++ b/webrtc/base/win32filesystem.cc @@ -72,13 +72,6 @@ bool Win32Filesystem::DeleteFile(const Pathname &filename) { return ::DeleteFile(ToUtf16(filename.pathname()).c_str()) != 0; } -bool Win32Filesystem::DeleteEmptyFolder(const Pathname &folder) { - LOG(LS_INFO) << "Deleting folder " << folder.pathname(); - - std::string no_slash(folder.pathname(), 0, folder.pathname().length()-1); - return ::RemoveDirectory(ToUtf16(no_slash).c_str()) != 0; -} - bool Win32Filesystem::GetTemporaryFolder(Pathname &pathname, bool create, const std::string *append) { wchar_t buffer[MAX_PATH + 1]; diff --git a/webrtc/base/win32filesystem.h b/webrtc/base/win32filesystem.h index a41cc3e4d4..7ddbbd7e6c 100644 --- a/webrtc/base/win32filesystem.h +++ b/webrtc/base/win32filesystem.h @@ -19,48 +19,47 @@ class Win32Filesystem : public FilesystemInterface { public: // This will attempt to delete the path located at filename. // If the path points to a folder, it will fail with VERIFY - virtual bool DeleteFile(const Pathname &filename); - - // This will attempt to delete an empty folder. If the path does not point to - // a folder, it fails with VERIFY. If the folder is not empty, it fails normally - virtual bool DeleteEmptyFolder(const Pathname &folder); + 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 - virtual bool CreateFolder(const Pathname &pathname); - + 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 // Returns true if the file is successfully moved - virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path); - + bool MoveFile(const Pathname& old_path, const Pathname& new_path) override; + // Returns true if a pathname is a directory - virtual bool IsFolder(const Pathname& pathname); - + bool IsFolder(const Pathname& pathname) override; + // Returns true if a file exists at path - virtual bool IsFile(const Pathname &path); + bool IsFile(const Pathname& path) override; // Returns true if pathname refers to no filesystem object, every parent // directory either exists, or is also absent. - virtual bool IsAbsent(const Pathname& pathname); + bool IsAbsent(const Pathname& pathname) override; // All of the following functions set pathname and return true if successful. // Returned paths always include a trailing backslash. // If create is true, the path will be recursively created. // If append is non-null, it will be appended (and possibly created). - virtual std::string TempFilename(const Pathname &dir, const std::string &prefix); + std::string TempFilename(const Pathname& dir, + const std::string& prefix) override; - virtual bool GetFileSize(const Pathname& path, size_t* size); - virtual bool GetFileTime(const Pathname& path, FileTimeType which, - time_t* time); + bool GetFileSize(const Pathname& path, size_t* size) override; + bool GetFileTime(const Pathname& path, + FileTimeType which, + time_t* time) override; // A folder appropriate for storing temporary files (Contents are // automatically deleted when the program exists) - virtual bool GetTemporaryFolder(Pathname &path, bool create, - const std::string *append); + bool GetTemporaryFolder(Pathname& path, + bool create, + const std::string* append) override; private: // Returns the path to the running application.