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

Unified Diff: webrtc/base/win32filesystem.cc

Issue 2699143002: Delete unused Filesystem methods GetAppDataFolder and GetDiskFreeSpace. (Closed)
Patch Set: Created 3 years, 10 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/win32filesystem.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/win32filesystem.cc
diff --git a/webrtc/base/win32filesystem.cc b/webrtc/base/win32filesystem.cc
index 7e5ec832d65080eeda9587d423f241541be2d20b..9e4ef51ffed7b4b53c17cf8d993f2e05eff1e9eb 100644
--- a/webrtc/base/win32filesystem.cc
+++ b/webrtc/base/win32filesystem.cc
@@ -216,34 +216,6 @@ bool Win32Filesystem::GetAppPathname(Pathname* path) {
return true;
}
-bool Win32Filesystem::GetAppDataFolder(Pathname* path, bool per_user) {
- RTC_DCHECK(!organization_name_.empty());
- RTC_DCHECK(!application_name_.empty());
- TCHAR buffer[MAX_PATH + 1];
- int csidl = per_user ? CSIDL_LOCAL_APPDATA : CSIDL_COMMON_APPDATA;
- if (!::SHGetSpecialFolderPath(NULL, buffer, csidl, TRUE))
- return false;
- if (!IsCurrentProcessLowIntegrity() &&
- !::GetLongPathName(buffer, buffer, arraysize(buffer)))
- return false;
- size_t len = strcatn(buffer, arraysize(buffer), __T("\\"));
- len += strcpyn(buffer + len, arraysize(buffer) - len,
- ToUtf16(organization_name_).c_str());
- if ((len > 0) && (buffer[len-1] != __T('\\'))) {
- len += strcpyn(buffer + len, arraysize(buffer) - len, __T("\\"));
- }
- len += strcpyn(buffer + len, arraysize(buffer) - len,
- ToUtf16(application_name_).c_str());
- if ((len > 0) && (buffer[len-1] != __T('\\'))) {
- len += strcpyn(buffer + len, arraysize(buffer) - len, __T("\\"));
- }
- if (len >= arraysize(buffer) - 1)
- return false;
- path->clear();
- path->SetFolder(ToUtf8(buffer));
- return CreateFolder(*path);
-}
-
bool Win32Filesystem::GetAppTempFolder(Pathname* path) {
if (!GetAppPathname(path))
return false;
@@ -251,47 +223,4 @@ bool Win32Filesystem::GetAppTempFolder(Pathname* path) {
return GetTemporaryFolder(*path, true, &filename);
}
-bool Win32Filesystem::GetDiskFreeSpace(const Pathname& path,
- int64_t* free_bytes) {
- if (!free_bytes) {
- return false;
- }
- char drive[4];
- std::wstring drive16;
- const wchar_t* target_drive = NULL;
- if (path.GetDrive(drive, sizeof(drive))) {
- drive16 = ToUtf16(drive);
- target_drive = drive16.c_str();
- } else if (path.folder().substr(0, 2) == "\\\\") {
- // UNC path, fail.
- // TODO: Handle UNC paths.
- return false;
- } else {
- // The path is probably relative. GetDriveType and GetDiskFreeSpaceEx
- // use the current drive if NULL is passed as the drive name.
- // TODO: Add method to Pathname to determine if the path is relative.
- // TODO: Add method to Pathname to convert a path to absolute.
- }
- UINT drive_type = ::GetDriveType(target_drive);
- if ((drive_type == DRIVE_REMOTE) || (drive_type == DRIVE_UNKNOWN)) {
- LOG(LS_VERBOSE) << "Remote or unknown drive: " << drive;
- return false;
- }
-
- int64_t total_number_of_bytes; // receives the number of bytes on disk
- int64_t total_number_of_free_bytes; // receives the free bytes on disk
- // make sure things won't change in 64 bit machine
- // TODO replace with compile time assert
- RTC_DCHECK(sizeof(ULARGE_INTEGER) == sizeof(uint64_t)); // NOLINT
- if (::GetDiskFreeSpaceEx(target_drive,
- (PULARGE_INTEGER)free_bytes,
- (PULARGE_INTEGER)&total_number_of_bytes,
- (PULARGE_INTEGER)&total_number_of_free_bytes)) {
- return true;
- } else {
- LOG(LS_VERBOSE) << "GetDiskFreeSpaceEx returns error.";
- return false;
- }
-}
-
} // namespace rtc
« no previous file with comments | « webrtc/base/win32filesystem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698