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 #include <pwd.h> | 5 #include <pwd.h> |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/port.h" | |
10 #include "chrome/browser/sync/util/path_helpers.h" | 9 #include "chrome/browser/sync/util/path_helpers.h" |
11 #include "strings/strutil.h" | |
12 | 10 |
13 #if ((!defined(OS_LINUX)) && (!defined(OS_MACOSX))) | 11 #if ((!defined(OS_LINUX)) && (!defined(OS_MACOSX))) |
14 #error Compile this file on Mac OS X or Linux only. | 12 #error Compile this file on Mac OS X or Linux only. |
15 #endif | 13 #endif |
16 | 14 |
17 PathString ExpandTilde(const PathString& path) { | 15 PathString ExpandTilde(const PathString& path) { |
18 if (path.empty()) | 16 if (path.empty()) |
19 return path; | 17 return path; |
20 if ('~' != path[0]) | 18 if ('~' != path[0]) |
21 return path; | 19 return path; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 88 |
91 // Convert /s to :s . | 89 // Convert /s to :s . |
92 PathString MakePathComponentOSLegal(const PathString& component) { | 90 PathString MakePathComponentOSLegal(const PathString& component) { |
93 if (PathString::npos == component.find("/")) | 91 if (PathString::npos == component.find("/")) |
94 return PSTR(""); | 92 return PSTR(""); |
95 PathString new_name; | 93 PathString new_name; |
96 new_name.reserve(component.size()); | 94 new_name.reserve(component.size()); |
97 StringReplace(component, "/", ":", true, &new_name); | 95 StringReplace(component, "/", ":", true, &new_name); |
98 return new_name; | 96 return new_name; |
99 } | 97 } |
OLD | NEW |