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

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

Issue 14588006: Fix VirtualPath::GetNormalizedFilePath on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 7 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_util_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_util.h" 5 #include "webkit/fileapi/file_system_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 components->push_back(component); 103 components->push_back(component);
104 begin = end + 1; 104 begin = end + 1;
105 } 105 }
106 } 106 }
107 107
108 base::FilePath::StringType VirtualPath::GetNormalizedFilePath( 108 base::FilePath::StringType VirtualPath::GetNormalizedFilePath(
109 const base::FilePath& path) { 109 const base::FilePath& path) {
110 base::FilePath::StringType normalized_path = path.value(); 110 base::FilePath::StringType normalized_path = path.value();
111 const size_t num_separators = base::FilePath::StringType( 111 const size_t num_separators = base::FilePath::StringType(
112 base::FilePath::kSeparators).length(); 112 base::FilePath::kSeparators).length();
113 for (size_t i = 1; i < num_separators; ++i) { 113 for (size_t i = 0; i < num_separators; ++i) {
114 std::replace(normalized_path.begin(), normalized_path.end(), 114 std::replace(normalized_path.begin(), normalized_path.end(),
115 base::FilePath::kSeparators[i], kSeparator); 115 base::FilePath::kSeparators[i], kSeparator);
116 } 116 }
117 117
118 return (IsAbsolute(normalized_path)) ? 118 return (IsAbsolute(normalized_path)) ?
119 normalized_path : base::FilePath::StringType(kRoot) + normalized_path; 119 normalized_path : base::FilePath::StringType(kRoot) + normalized_path;
120 } 120 }
121 121
122 bool VirtualPath::IsAbsolute(const base::FilePath::StringType& path) { 122 bool VirtualPath::IsAbsolute(const base::FilePath::StringType& path) {
123 return path.find(kRoot) == 0; 123 return path.find(kRoot) == 0;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 root.append("/"); 374 root.append("/");
375 } 375 }
376 return root; 376 return root;
377 } 377 }
378 378
379 bool AreSameFileSystem(const FileSystemURL& url1, const FileSystemURL& url2) { 379 bool AreSameFileSystem(const FileSystemURL& url1, const FileSystemURL& url2) {
380 return url1.origin() == url2.origin() && url1.type() == url2.type(); 380 return url1.origin() == url2.origin() && url1.type() == url2.type();
381 } 381 }
382 382
383 } // namespace fileapi 383 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_system_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698