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)
| 2274 | return 0 |
| 2275 | |
| 2276 | def PathSplitToList(path): |
| 2277 | """Returns the path split into a list by the separator. |
| 2278 | |
| 2279 | Args: |
| 2280 | path: An absolute or relative path (e.g. '/a/b/c/' or '../a') |
| 2281 | |
| 2282 | Returns: |
| 2283 | A list of path components (e.g. ['a', 'b', 'c]). |
| 2284 | """ |
| 2285 | lst = [] |
| 2286 | while True: |
| 2287 | (head, tail) = os.path.split(path) |
| 2288 | if head == path: # absolute paths end |
| 2289 | lst.append(head) |
| 2290 | break |
| 2291 | if tail == path: # relative paths end |
| 2292 | lst.append(tail) |
| 2293 | break |
| 2294 | |
| 2295 | path = head |
| 2296 | lst.append(tail) |
| 2297 | |
| 2298 | lst.reverse() |
| 2299 | return lst |
| 2300 | |
| 2301 | def GetHeaderGuardCPPVariable(filename): |
| 2302 | """Returns the CPP variable that should be used as a header guard. |
no test coverage detected