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

Unified Diff: webrtc/base/fileutils.h

Issue 2445733002: Delete unused features of rtc::FilesystemInterface. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | webrtc/base/fileutils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/fileutils.h
diff --git a/webrtc/base/fileutils.h b/webrtc/base/fileutils.h
index 23d36b15f47c6257cbaa37ee994c8d65bb503357..9489de8193df95e8cb28de55d5f36f832900e796 100644
--- a/webrtc/base/fileutils.h
+++ b/webrtc/base/fileutils.h
@@ -63,18 +63,6 @@ class DirectoryIterator {
// returns the name of the file currently pointed to
virtual std::string Name() const;
- // returns the size of the file currently pointed to
- virtual size_t FileSize() const;
-
- // returns true if the file is older than seconds
- virtual bool OlderThan(int seconds) const;
-
- // checks whether current file is a special directory file "." or ".."
- bool IsDots() const {
- std::string filename(Name());
- return (filename.compare(".") == 0) || (filename.compare("..") == 0);
- }
-
private:
std::string directory_;
#if defined(WEBRTC_WIN)
@@ -104,15 +92,6 @@ class FilesystemInterface {
virtual FileStream *OpenFile(const Pathname &filename,
const std::string &mode) = 0;
- // Atomically creates an empty file accessible only to the current user if one
- // does not already exist at the given path, otherwise fails. This is the only
- // secure way to create a file in a shared temp directory (e.g., C:\Temp on
- // Windows or /tmp on Linux).
- // Note that if it is essential that a file be successfully created then the
- // app must generate random names and retry on failure, or else it will be
- // vulnerable to a trivial DoS.
- virtual bool CreatePrivateFile(const Pathname &filename) = 0;
-
// This will attempt to delete the path located at filename.
// It ASSERTS and returns false if the path points to a folder or a
// non-existent file.
@@ -133,16 +112,6 @@ class FilesystemInterface {
// the folder itself.
virtual bool DeleteFolderAndContents(const Pathname& folder);
- // This will delete whatever is located at path, be it a file or a folder.
- // If it is a folder, it will delete it recursively by calling
- // DeleteFolderAndContents
- bool DeleteFileOrFolder(const Pathname &path) {
- if (IsFolder(path))
- return DeleteFolderAndContents(path);
- else
- return DeleteFile(path);
- }
-
// 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;
@@ -152,41 +121,13 @@ class FilesystemInterface {
// directory, and returns true if the function succeeds.
// If the new path is on a different volume than the old path, this function
// will attempt to copy and, if that succeeds, delete the old path.
- virtual bool MoveFolder(const Pathname &old_path,
- const Pathname &new_path) = 0;
-
- // This moves a directory from old_path to new_path, where "old_path" is a
- // directory. This ASSERTs and returns false if old_path points to a plain
- // file, and returns true if the function succeeds.
- // If the new path is on a different volume, this function will attempt to
- // copy and if that succeeds, delete the old path.
virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path) = 0;
- // This attempts to move whatever is located at old_path to new_path,
- // be it a file or folder.
- bool MoveFileOrFolder(const Pathname &old_path, const Pathname &new_path) {
- if (IsFile(old_path)) {
- return MoveFile(old_path, new_path);
- } else {
- return MoveFolder(old_path, new_path);
- }
- }
-
// This copies a file from old_path to new_path. This method ASSERTs and
// returns false if old_path is a folder, and returns true if the copy
// succeeds.
virtual bool CopyFile(const Pathname &old_path, const Pathname &new_path) = 0;
- // This copies a folder from old_path to new_path.
- bool CopyFolder(const Pathname &old_path, const Pathname &new_path);
-
- bool CopyFileOrFolder(const Pathname &old_path, const Pathname &new_path) {
- if (IsFile(old_path))
- return CopyFile(old_path, new_path);
- else
- return CopyFolder(old_path, new_path);
- }
-
// Returns true if pathname refers to a directory
virtual bool IsFolder(const Pathname& pathname) = 0;
@@ -215,11 +156,6 @@ class FilesystemInterface {
virtual bool GetFileTime(const Pathname& path, FileTimeType which,
time_t* time) = 0;
- // Returns the path to the running application.
- // Note: This is not guaranteed to work on all platforms. Be aware of the
- // limitations before using it, and robustly handle failure.
- virtual bool GetAppPathname(Pathname* path) = 0;
-
// Get a folder that is unique to the current application, which is suitable
// for sharing data between executions of the app. If the per_user arg is
// true, the folder is also specific to the current user.
@@ -231,14 +167,8 @@ class FilesystemInterface {
// will be cleaned up when the program exits.
virtual bool GetAppTempFolder(Pathname* path) = 0;
- // Delete the contents of the folder returned by GetAppTempFolder
- bool CleanAppTempFolder();
-
virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) = 0;
- // Returns the absolute path of the current directory.
- virtual Pathname GetCurrentDirectory() = 0;
-
// Note: These might go into some shared config section later, but they're
// used by some methods in this interface, so we're leaving them here for now.
void SetOrganizationName(const std::string& organization) {
@@ -292,18 +222,10 @@ class Filesystem {
return EnsureDefaultFilesystem()->OpenFile(filename, mode);
}
- static bool CreatePrivateFile(const Pathname &filename) {
- return EnsureDefaultFilesystem()->CreatePrivateFile(filename);
- }
-
static bool DeleteFile(const Pathname &filename) {
return EnsureDefaultFilesystem()->DeleteFile(filename);
}
- static bool DeleteEmptyFolder(const Pathname &folder) {
- return EnsureDefaultFilesystem()->DeleteEmptyFolder(folder);
- }
-
static bool DeleteFolderContents(const Pathname &folder) {
return EnsureDefaultFilesystem()->DeleteFolderContents(folder);
}
@@ -312,18 +234,10 @@ class Filesystem {
return EnsureDefaultFilesystem()->DeleteFolderAndContents(folder);
}
- static bool MoveFolder(const Pathname &old_path, const Pathname &new_path) {
- return EnsureDefaultFilesystem()->MoveFolder(old_path, new_path);
- }
-
static bool MoveFile(const Pathname &old_path, const Pathname &new_path) {
return EnsureDefaultFilesystem()->MoveFile(old_path, new_path);
}
- static bool CopyFolder(const Pathname &old_path, const Pathname &new_path) {
- return EnsureDefaultFilesystem()->CopyFolder(old_path, new_path);
- }
-
static bool CopyFile(const Pathname &old_path, const Pathname &new_path) {
return EnsureDefaultFilesystem()->CopyFile(old_path, new_path);
}
@@ -363,10 +277,6 @@ class Filesystem {
return EnsureDefaultFilesystem()->GetFileTime(path, which, time);
}
- static bool GetAppPathname(Pathname* path) {
- return EnsureDefaultFilesystem()->GetAppPathname(path);
- }
-
static bool GetAppDataFolder(Pathname* path, bool per_user) {
return EnsureDefaultFilesystem()->GetAppDataFolder(path, per_user);
}
@@ -375,18 +285,10 @@ class Filesystem {
return EnsureDefaultFilesystem()->GetAppTempFolder(path);
}
- static bool CleanAppTempFolder() {
- return EnsureDefaultFilesystem()->CleanAppTempFolder();
- }
-
static bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) {
return EnsureDefaultFilesystem()->GetDiskFreeSpace(path, freebytes);
}
- // Definition has to be in the .cc file due to returning forward-declared
- // Pathname by value.
- static Pathname GetCurrentDirectory();
-
static void SetOrganizationName(const std::string& organization) {
EnsureDefaultFilesystem()->SetOrganizationName(organization);
}
@@ -423,14 +325,6 @@ class FilesystemScope{
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope);
};
-// Generates a unique filename based on the input path. If no path component
-// is specified, it uses the temporary directory. If a filename is provided,
-// up to 100 variations of form basename-N.extension are tried. When
-// create_empty is true, an empty file of this name is created (which
-// decreases the chance of a temporary filename collision with another
-// process).
-bool CreateUniqueFile(Pathname& path, bool create_empty);
-
} // namespace rtc
#endif // WEBRTC_BASE_FILEUTILS_H_
« no previous file with comments | « no previous file | webrtc/base/fileutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698