MCPcopy Index your code
hub / github.com/nodejs/node / PathSplitToList

Function PathSplitToList

tools/cpplint.py:2513–2536  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2511
2512
2513def PathSplitToList(path):
2514 """Returns the path split into a list by the separator.
2515
2516 Args:
2517 path: An absolute or relative path (e.g. '/a/b/c/' or '../a')
2518
2519 Returns:
2520 A list of path components (e.g. ['a', 'b', 'c]).
2521 """
2522 lst = []
2523 while True:
2524 (head, tail) = os.path.split(path)
2525 if head == path: # absolute paths end
2526 lst.append(head)
2527 break
2528 if tail == path: # relative paths end
2529 lst.append(tail)
2530 break
2531
2532 path = head
2533 lst.append(tail)
2534
2535 lst.reverse()
2536 return lst
2537
2538
2539def GetHeaderGuardCPPVariable(filename):

Callers 1

FixupPathFromRootFunction · 0.85

Calls 2

splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…