Delete unused method FilesystemInterface::DeleteEmptyFolder.

It's left-over since cl https://codereview.webrtc.org/2887093002.

In addition, fix override declarations and formatting in
win32filesystem.h.

BUG=webrtc:7345,webrtc:6424

Review-Url: https://codereview.webrtc.org/2930023002
Cr-Commit-Position: refs/heads/master@{#18549}
This commit is contained in:
nisse 2017-06-13 00:10:07 -07:00 committed by Commit Bot
parent f9fc4a5d03
commit f52ef71db7
5 changed files with 18 additions and 48 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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.

View File

@ -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];

View File

@ -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.