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

Side by Side Diff: webkit/fileapi/file_system_file_util.cc

Issue 6881078: Modify error code of move/copy preparation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/fileapi/file_system_operation_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/fileapi/file_system_file_util.h" 5 #include "webkit/fileapi/file_system_file_util.h"
6 6
7 #include "base/file_util_proxy.h" 7 #include "base/file_util_proxy.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 10
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 // Now it is ok to return if the |dest_file_path| does not exist. 228 // Now it is ok to return if the |dest_file_path| does not exist.
229 if (!PathExists(context, dest_file_path)) 229 if (!PathExists(context, dest_file_path))
230 return base::PLATFORM_FILE_OK; 230 return base::PLATFORM_FILE_OK;
231 231
232 // |src_file_path| exists and is a directory. 232 // |src_file_path| exists and is a directory.
233 // |dest_file_path| exists and is a file. 233 // |dest_file_path| exists and is a file.
234 bool src_is_directory = DirectoryExists(context, src_file_path); 234 bool src_is_directory = DirectoryExists(context, src_file_path);
235 bool dest_is_directory = DirectoryExists(context, dest_file_path); 235 bool dest_is_directory = DirectoryExists(context, dest_file_path);
236 if (src_is_directory && !dest_is_directory) 236 if (src_is_directory && !dest_is_directory)
237 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; 237 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
238 238
239 // |src_file_path| exists and is a file. 239 // |src_file_path| exists and is a file.
240 // |dest_file_path| exists and is a directory. 240 // |dest_file_path| exists and is a directory.
241 if (!src_is_directory && dest_is_directory) 241 if (!src_is_directory && dest_is_directory)
242 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; 242 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
243 243
244 // It is an error to copy/move an entry into the same path. 244 // It is an error to copy/move an entry into the same path.
245 if (src_file_path.value() == dest_file_path.value()) 245 if (src_file_path.value() == dest_file_path.value())
246 return base::PLATFORM_FILE_ERROR_EXISTS; 246 return base::PLATFORM_FILE_ERROR_EXISTS;
247 247
248 if (dest_is_directory) { 248 if (dest_is_directory) {
249 // It is an error to copy/move an entry to a non-empty directory. 249 // It is an error to copy/move an entry to a non-empty directory.
250 // Otherwise the copy/move attempt must overwrite the destination, but 250 // Otherwise the copy/move attempt must overwrite the destination, but
251 // the file_util's Copy or Move method doesn't perform overwrite 251 // the file_util's Copy or Move method doesn't perform overwrite
252 // on all platforms, so we delete the destination directory here. 252 // on all platforms, so we delete the destination directory here.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 FileSystemFileUtil::AbstractFileEnumerator* 366 FileSystemFileUtil::AbstractFileEnumerator*
367 FileSystemFileUtil::CreateFileEnumerator(const FilePath& root_path) { 367 FileSystemFileUtil::CreateFileEnumerator(const FilePath& root_path) {
368 return new FileSystemFileEnumerator( 368 return new FileSystemFileEnumerator(
369 root_path, true, static_cast<file_util::FileEnumerator::FILE_TYPE>( 369 root_path, true, static_cast<file_util::FileEnumerator::FILE_TYPE>(
370 file_util::FileEnumerator::FILES | 370 file_util::FileEnumerator::FILES |
371 file_util::FileEnumerator::DIRECTORIES)); 371 file_util::FileEnumerator::DIRECTORIES));
372 } 372 }
373 373
374 } // namespace fileapi 374 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_system_operation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698