Returns the path split into a list by the separator. Args: path: An absolute or relative path (e.g. '/a/b/c/' or '../a') Returns: A list of path components (e.g. ['a', 'b', 'c]).
(path)
| 2259 | return 0 |
| 2260 | |
| 2261 | def PathSplitToList(path): |
| 2262 | """Returns the path split into a list by the separator. |
| 2263 | |
| 2264 | Args: |
| 2265 | path: An absolute or relative path (e.g. '/a/b/c/' or '../a') |
| 2266 | |
| 2267 | Returns: |
| 2268 | A list of path components (e.g. ['a', 'b', 'c]). |
| 2269 | """ |
| 2270 | lst = [] |
| 2271 | while True: |
| 2272 | (head, tail) = os.path.split(path) |
| 2273 | if head == path: # absolute paths end |
| 2274 | lst.append(head) |
| 2275 | break |
| 2276 | if tail == path: # relative paths end |
| 2277 | lst.append(tail) |
| 2278 | break |
| 2279 | |
| 2280 | path = head |
| 2281 | lst.append(tail) |
| 2282 | |
| 2283 | lst.reverse() |
| 2284 | return lst |
| 2285 | |
| 2286 | def GetHeaderGuardCPPVariable(filename): |
| 2287 | """Returns the CPP variable that should be used as a header guard. |
no test coverage detected