OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 // TODO: add unittests for all these operations | 10 // TODO: add unittests for all these operations |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUIL
D_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS) | 116 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUIL
D_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS) |
117 DIR* fDIR; | 117 DIR* fDIR; |
118 SkString fPath, fSuffix; | 118 SkString fPath, fSuffix; |
119 #endif | 119 #endif |
120 }; | 120 }; |
121 }; | 121 }; |
122 | 122 |
123 /** | 123 /** |
124 * Functions for modifying SkStrings which represent paths on the filesystem. | 124 * Functions for modifying SkStrings which represent paths on the filesystem. |
125 */ | 125 */ |
126 class SkOSPath { | 126 class SkOSPath { |
127 public: | 127 public: |
128 /** | 128 /** |
129 * Assembles rootPath and relativePath into a single path, like this: | 129 * Assembles rootPath and relativePath into a single path, like this: |
130 * rootPath/relativePath. | 130 * rootPath/relativePath. |
131 * It is okay to call with a NULL rootPath and/or relativePath. A path | 131 * It is okay to call with a NULL rootPath and/or relativePath. A path |
132 * separator will still be inserted. | 132 * separator will still be inserted. |
133 * | 133 * |
134 * Uses SkPATH_SEPARATOR, to work on all platforms. | 134 * Uses SkPATH_SEPARATOR, to work on all platforms. |
135 */ | 135 */ |
136 static SkString Join(const char* rootPath, const char* relativePath); | 136 static SkString Join(const char* rootPath, const char* relativePath); |
137 | 137 |
138 /** | 138 /** |
139 * Return the name of the file, ignoring the directory structure. | 139 * Return the name of the file, ignoring the directory structure. |
140 * Behaves like python's os.path.basename. If the fullPath is | 140 * Behaves like python's os.path.basename. If the fullPath is |
141 * /dir/subdir/, an empty string is returned. | 141 * /dir/subdir/, an empty string is returned. |
142 * @param fullPath Full path to the file. | 142 * @param fullPath Full path to the file. |
143 * @return SkString The basename of the file - anything beyond the | 143 * @return SkString The basename of the file - anything beyond the |
144 * final slash, or the full name if there is no slash. | 144 * final slash, or the full name if there is no slash. |
145 */ | 145 */ |
146 static SkString Basename(const char* fullPath); | 146 static SkString Basename(const char* fullPath); |
| 147 |
| 148 /** |
| 149 * Given a qualified file name returns the directory. |
| 150 * Behaves like python's os.path.dirname. If the fullPath is |
| 151 * /dir/subdir/ the return will be /dir/subdir/ |
| 152 * @param fullPath Full path to the file. |
| 153 * @return SkString The dir containing the file - anything preceding the |
| 154 * final slash, or the full name if ending in a slash. |
| 155 */ |
| 156 static SkString Dirname(const char* fullPath); |
| 157 |
147 }; | 158 }; |
148 | 159 |
149 #endif | 160 #endif |
OLD | NEW |