diff --git a/rtc_base/fileutils.h b/rtc_base/fileutils.h index 6f20a20313..b9e8a05df7 100644 --- a/rtc_base/fileutils.h +++ b/rtc_base/fileutils.h @@ -96,9 +96,6 @@ class FilesystemInterface { // Returns true if pathname refers to a file virtual bool IsFile(const Pathname& pathname) = 0; - virtual std::string TempFilename(const Pathname &dir, - const std::string &prefix) = 0; - // Determines the size of the file indicated by path. virtual bool GetFileSize(const Pathname& path, size_t* size) = 0; }; @@ -137,11 +134,6 @@ class Filesystem { return EnsureDefaultFilesystem()->IsFile(pathname); } - static std::string TempFilename(const Pathname &dir, - const std::string &prefix) { - return EnsureDefaultFilesystem()->TempFilename(dir, prefix); - } - static bool GetFileSize(const Pathname& path, size_t* size) { return EnsureDefaultFilesystem()->GetFileSize(path, size); } diff --git a/rtc_base/unixfilesystem.cc b/rtc_base/unixfilesystem.cc index 8732d477a3..a48aca1a33 100644 --- a/rtc_base/unixfilesystem.cc +++ b/rtc_base/unixfilesystem.cc @@ -67,22 +67,6 @@ bool UnixFilesystem::DeleteFile(const Pathname &filename) { return ::unlink(filename.pathname().c_str()) == 0; } -std::string UnixFilesystem::TempFilename(const Pathname &dir, - const std::string &prefix) { - int len = dir.pathname().size() + prefix.size() + 2 + 6; - char *tempname = new char[len]; - - snprintf(tempname, len, "%s/%sXXXXXX", dir.pathname().c_str(), - prefix.c_str()); - int fd = ::mkstemp(tempname); - if (fd != -1) - ::close(fd); - std::string ret(tempname); - delete[] tempname; - - return ret; -} - bool UnixFilesystem::MoveFile(const Pathname &old_path, const Pathname &new_path) { if (!IsFile(old_path)) { @@ -119,18 +103,6 @@ bool UnixFilesystem::GetFileSize(const Pathname& pathname, size_t *size) { return true; } -char* UnixFilesystem::CopyString(const std::string& str) { - size_t size = str.length() + 1; - - char* buf = new char[size]; - if (!buf) { - return nullptr; - } - - strcpyn(buf, size, str.c_str()); - return buf; -} - } // namespace rtc #if defined(__native_client__) diff --git a/rtc_base/unixfilesystem.h b/rtc_base/unixfilesystem.h index 27966f3aec..711d7b3ea1 100644 --- a/rtc_base/unixfilesystem.h +++ b/rtc_base/unixfilesystem.h @@ -37,20 +37,7 @@ class UnixFilesystem : public FilesystemInterface { // Returns true of pathname represents an existing file bool IsFile(const Pathname& pathname) override; - std::string TempFilename(const Pathname& dir, - const std::string& prefix) override; - bool GetFileSize(const Pathname& path, size_t* size) override; - - private: -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) - static char* provided_app_data_folder_; - static char* provided_app_temp_folder_; -#else - static char* app_temp_path_; -#endif - - static char* CopyString(const std::string& str); }; } // namespace rtc diff --git a/rtc_base/win32filesystem.cc b/rtc_base/win32filesystem.cc index 511f9664e7..8ca84c34bb 100644 --- a/rtc_base/win32filesystem.cc +++ b/rtc_base/win32filesystem.cc @@ -42,16 +42,6 @@ bool Win32Filesystem::DeleteFile(const Pathname &filename) { return ::DeleteFile(ToUtf16(filename.pathname()).c_str()) != 0; } -std::string Win32Filesystem::TempFilename(const Pathname &dir, - const std::string &prefix) { - wchar_t filename[MAX_PATH]; - if (::GetTempFileName(ToUtf16(dir.pathname()).c_str(), - ToUtf16(prefix).c_str(), 0, filename) != 0) - return ToUtf8(filename); - RTC_NOTREACHED(); - return ""; -} - bool Win32Filesystem::MoveFile(const Pathname &old_path, const Pathname &new_path) { if (!IsFile(old_path)) { diff --git a/rtc_base/win32filesystem.h b/rtc_base/win32filesystem.h index e65d127cb2..d26741e67b 100644 --- a/rtc_base/win32filesystem.h +++ b/rtc_base/win32filesystem.h @@ -33,14 +33,6 @@ class Win32Filesystem : public FilesystemInterface { // Returns true if a file exists at path bool IsFile(const Pathname& path) 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). - - std::string TempFilename(const Pathname& dir, - const std::string& prefix) override; - bool GetFileSize(const Pathname& path, size_t* size) override; };