| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ |
| 6 #define CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 typename StringType::size_type segment_end_; | 65 typename StringType::size_type segment_end_; |
| 66 StringType value_; | 66 StringType value_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // NOTE: The functions (Strip)LastPathSegment always return values without a | 69 // NOTE: The functions (Strip)LastPathSegment always return values without a |
| 70 // trailing slash. | 70 // trailing slash. |
| 71 PathString LastPathSegment(const PathString& path); | 71 PathString LastPathSegment(const PathString& path); |
| 72 std::string LastPathSegment(const std::string& path); | 72 std::string LastPathSegment(const std::string& path); |
| 73 PathString AppendSlash(const PathString& path); | 73 PathString AppendSlash(const PathString& path); |
| 74 PathString GetFullPath(const PathString& path); | 74 PathString GetFullPath(const PathString& path); |
| 75 PathString LowercasePath(const PathString& path); | |
| 76 PathString ExpandTilde(const PathString& path); | 75 PathString ExpandTilde(const PathString& path); |
| 77 | 76 |
| 78 inline bool HasSuffixPathString(const PathString& str, | 77 inline bool HasSuffixPathString(const PathString& str, |
| 79 const PathString& suffix) { | 78 const PathString& suffix) { |
| 80 return str.find(suffix, str.size() - suffix.size()) != PathString::npos; | 79 return str.find(suffix, str.size() - suffix.size()) != PathString::npos; |
| 81 } | 80 } |
| 82 | 81 |
| 83 inline PathString StripSuffixPathString(const PathString& str, | 82 inline PathString StripSuffixPathString(const PathString& str, |
| 84 const PathString& suffix) { | 83 const PathString& suffix) { |
| 85 PathString ret(str); | 84 PathString ret(str); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 // Makes a path component legal for your OS, but doesn't handle collisions | 95 // Makes a path component legal for your OS, but doesn't handle collisions |
| 97 // with other files in the same directory. it can do this by removing | 96 // with other files in the same directory. it can do this by removing |
| 98 // illegal characters and adding ~1 before the first '.' in the filename. | 97 // illegal characters and adding ~1 before the first '.' in the filename. |
| 99 // returns PSTR("") if the name is fine as-is | 98 // returns PSTR("") if the name is fine as-is |
| 100 // on mac/linux we let names stay unicode normalization form C in the system | 99 // on mac/linux we let names stay unicode normalization form C in the system |
| 101 // and convert to another normal form in fuse handlers. but, if a '/' is in | 100 // and convert to another normal form in fuse handlers. but, if a '/' is in |
| 102 // a filename, we handle it here. | 101 // a filename, we handle it here. |
| 103 PathString MakePathComponentOSLegal(const PathString& component); | 102 PathString MakePathComponentOSLegal(const PathString& component); |
| 104 | 103 |
| 105 #endif // CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ | 104 #endif // CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ |
| OLD | NEW |