| Index: webrtc/base/fileutils.cc
|
| diff --git a/webrtc/base/fileutils.cc b/webrtc/base/fileutils.cc
|
| index ae9309ce1b5cc6332c3397698ff7598151b25e09..cb63cce7d630ca9379723261ff29ea502808e19a 100644
|
| --- a/webrtc/base/fileutils.cc
|
| +++ b/webrtc/base/fileutils.cc
|
| @@ -117,25 +117,6 @@ std::string DirectoryIterator::Name() const {
|
| #endif
|
| }
|
|
|
| - // returns the size of the file currently pointed to
|
| -size_t DirectoryIterator::FileSize() const {
|
| -#if !defined(WEBRTC_WIN)
|
| - return stat_.st_size;
|
| -#else
|
| - return data_.nFileSizeLow;
|
| -#endif
|
| -}
|
| -
|
| -bool DirectoryIterator::OlderThan(int seconds) const {
|
| - time_t file_modify_time;
|
| -#if defined(WEBRTC_WIN)
|
| - FileTimeToUnixTime(data_.ftLastWriteTime, &file_modify_time);
|
| -#else
|
| - file_modify_time = stat_.st_mtime;
|
| -#endif
|
| - return time(NULL) - file_modify_time >= seconds;
|
| -}
|
| -
|
| FilesystemInterface* Filesystem::default_filesystem_ = NULL;
|
|
|
| FilesystemInterface *Filesystem::EnsureDefaultFilesystem() {
|
| @@ -153,37 +134,6 @@ DirectoryIterator* FilesystemInterface::IterateDirectory() {
|
| return new DirectoryIterator();
|
| }
|
|
|
| -bool FilesystemInterface::CopyFolder(const Pathname &old_path,
|
| - const Pathname &new_path) {
|
| - bool success = true;
|
| - VERIFY(IsFolder(old_path));
|
| - Pathname new_dir;
|
| - new_dir.SetFolder(new_path.pathname());
|
| - Pathname old_dir;
|
| - old_dir.SetFolder(old_path.pathname());
|
| - if (!CreateFolder(new_dir))
|
| - return false;
|
| - DirectoryIterator *di = IterateDirectory();
|
| - if (!di)
|
| - return false;
|
| - if (di->Iterate(old_dir.pathname())) {
|
| - do {
|
| - if (di->Name() == "." || di->Name() == "..")
|
| - continue;
|
| - Pathname source;
|
| - Pathname dest;
|
| - source.SetFolder(old_dir.pathname());
|
| - dest.SetFolder(new_path.pathname());
|
| - source.SetFilename(di->Name());
|
| - dest.SetFilename(di->Name());
|
| - if (!CopyFileOrFolder(source, dest))
|
| - success = false;
|
| - } while (di->Next());
|
| - }
|
| - delete di;
|
| - return success;
|
| -}
|
| -
|
| bool FilesystemInterface::DeleteFolderContents(const Pathname &folder) {
|
| bool success = true;
|
| VERIFY(IsFolder(folder));
|
| @@ -217,68 +167,4 @@ bool FilesystemInterface::DeleteFolderAndContents(const Pathname& folder) {
|
| return DeleteFolderContents(folder) && DeleteEmptyFolder(folder);
|
| }
|
|
|
| -bool FilesystemInterface::CleanAppTempFolder() {
|
| - Pathname path;
|
| - if (!GetAppTempFolder(&path))
|
| - return false;
|
| - if (IsAbsent(path))
|
| - return true;
|
| - if (!IsTemporaryPath(path)) {
|
| - ASSERT(false);
|
| - return false;
|
| - }
|
| - return DeleteFolderContents(path);
|
| -}
|
| -
|
| -Pathname Filesystem::GetCurrentDirectory() {
|
| - return EnsureDefaultFilesystem()->GetCurrentDirectory();
|
| -}
|
| -
|
| -bool CreateUniqueFile(Pathname& path, bool create_empty) {
|
| - LOG(LS_INFO) << "Path " << path.pathname() << std::endl;
|
| - // If no folder is supplied, use the temporary folder
|
| - if (path.folder().empty()) {
|
| - Pathname temporary_path;
|
| - if (!Filesystem::GetTemporaryFolder(temporary_path, true, NULL)) {
|
| - printf("Get temp failed\n");
|
| - return false;
|
| - }
|
| - path.SetFolder(temporary_path.pathname());
|
| - }
|
| -
|
| - // If no filename is supplied, use a temporary name
|
| - if (path.filename().empty()) {
|
| - std::string folder(path.folder());
|
| - std::string filename = Filesystem::TempFilename(folder, "gt");
|
| - path.SetPathname(filename);
|
| - if (!create_empty) {
|
| - Filesystem::DeleteFile(path.pathname());
|
| - }
|
| - return true;
|
| - }
|
| -
|
| - // Otherwise, create a unique name based on the given filename
|
| - // foo.txt -> foo-N.txt
|
| - const std::string basename = path.basename();
|
| - const size_t MAX_VERSION = 100;
|
| - size_t version = 0;
|
| - while (version < MAX_VERSION) {
|
| - std::string pathname = path.pathname();
|
| -
|
| - if (!Filesystem::IsFile(pathname)) {
|
| - if (create_empty) {
|
| - FileStream* fs = Filesystem::OpenFile(pathname, "w");
|
| - delete fs;
|
| - }
|
| - return true;
|
| - }
|
| - version += 1;
|
| - char version_base[MAX_PATH];
|
| - sprintfn(version_base, arraysize(version_base), "%s-%u", basename.c_str(),
|
| - version);
|
| - path.SetBasename(version_base);
|
| - }
|
| - return true;
|
| -}
|
| -
|
| } // namespace rtc
|
|
|