diff options
author | Andras Becsi <andras.becsi@digia.com> | 2014-03-18 13:16:26 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-03-20 15:55:39 +0100 |
commit | 3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch) | |
tree | 92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/base/file_util.cc | |
parent | e90d7c4b152c56919d963987e2503f9909a666d2 (diff) | |
download | qtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz |
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies
needed on Windows.
Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42
Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu>
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/base/file_util.cc')
-rw-r--r-- | chromium/base/file_util.cc | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/chromium/base/file_util.cc b/chromium/base/file_util.cc index e9806763855..1575a079d6b 100644 --- a/chromium/base/file_util.cc +++ b/chromium/base/file_util.cc @@ -23,8 +23,6 @@ namespace base { namespace { -const FilePath::CharType kExtensionSeparator = FILE_PATH_LITERAL('.'); - // The maximum number of 'uniquified' files we will try to create. // This is used when the filename we're trying to download is already in use, // so we create a new unique filename by appending " (nnn)" before the @@ -34,8 +32,6 @@ static const int kMaxUniqueFiles = 100; } // namespace -bool g_bug108724_debug = false; - int64 ComputeDirectorySize(const FilePath& root_path) { int64 running_size = 0; FileEnumerator file_iter(root_path, true, FileEnumerator::FILES); @@ -133,7 +129,7 @@ bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2) { bool ReadFileToString(const FilePath& path, std::string* contents) { if (path.ReferencesParent()) return false; - FILE* file = file_util::OpenFile(path, "rb"); + FILE* file = OpenFile(path, "rb"); if (!file) { return false; } @@ -144,22 +140,11 @@ bool ReadFileToString(const FilePath& path, std::string* contents) { if (contents) contents->append(buf, len); } - file_util::CloseFile(file); + CloseFile(file); return true; } -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - -using base::FileEnumerator; -using base::FilePath; -using base::kExtensionSeparator; -using base::kMaxUniqueFiles; - bool IsDirectoryEmpty(const FilePath& dir_path) { FileEnumerator files(dir_path, false, FileEnumerator::FILES | FileEnumerator::DIRECTORIES); @@ -176,12 +161,12 @@ FILE* CreateAndOpenTemporaryFile(FilePath* path) { return CreateAndOpenTemporaryFileInDir(directory, path); } -bool CreateDirectory(const base::FilePath& full_path) { +bool CreateDirectory(const FilePath& full_path) { return CreateDirectoryAndGetError(full_path, NULL); } bool GetFileSize(const FilePath& file_path, int64* file_size) { - base::PlatformFileInfo info; + PlatformFileInfo info; if (!GetFileInfo(file_path, &info)) return false; *file_size = info.size; @@ -189,32 +174,26 @@ bool GetFileSize(const FilePath& file_path, int64* file_size) { } bool TouchFile(const FilePath& path, - const base::Time& last_accessed, - const base::Time& last_modified) { - int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE_ATTRIBUTES; + const Time& last_accessed, + const Time& last_modified) { + int flags = PLATFORM_FILE_OPEN | PLATFORM_FILE_WRITE_ATTRIBUTES; #if defined(OS_WIN) // On Windows, FILE_FLAG_BACKUP_SEMANTICS is needed to open a directory. if (DirectoryExists(path)) - flags |= base::PLATFORM_FILE_BACKUP_SEMANTICS; + flags |= PLATFORM_FILE_BACKUP_SEMANTICS; #endif // OS_WIN - const base::PlatformFile file = - base::CreatePlatformFile(path, flags, NULL, NULL); - if (file != base::kInvalidPlatformFileValue) { - bool result = base::TouchPlatformFile(file, last_accessed, last_modified); - base::ClosePlatformFile(file); + const PlatformFile file = CreatePlatformFile(path, flags, NULL, NULL); + if (file != kInvalidPlatformFileValue) { + bool result = TouchPlatformFile(file, last_accessed, last_modified); + ClosePlatformFile(file); return result; } return false; } -bool SetLastModifiedTime(const FilePath& path, - const base::Time& last_modified) { - return TouchFile(path, last_modified, last_modified); -} - bool CloseFile(FILE* file) { if (file == NULL) return true; @@ -239,6 +218,15 @@ bool TruncateFile(FILE* file) { return true; } +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::FilePath; +using base::kMaxUniqueFiles; + int GetUniquePathNumber( const FilePath& path, const FilePath::StringType& suffix) { |