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)
| 1782 | return 0 |
| 1783 | |
| 1784 | def PathSplitToList(path): |
| 1785 | """Returns the path split into a list by the separator. |
| 1786 | |
| 1787 | Args: |
| 1788 | path: An absolute or relative path (e.g. '/a/b/c/' or '../a') |
| 1789 | |
| 1790 | Returns: |
| 1791 | A list of path components (e.g. ['a', 'b', 'c]). |
| 1792 | """ |
| 1793 | lst = [] |
| 1794 | while True: |
| 1795 | (head, tail) = os.path.split(path) |
| 1796 | if head == path: # absolute paths end |
| 1797 | lst.append(head) |
| 1798 | break |
| 1799 | if tail == path: # relative paths end |
| 1800 | lst.append(tail) |
| 1801 | break |
| 1802 | |
| 1803 | path = head |
| 1804 | lst.append(tail) |
| 1805 | |
| 1806 | lst.reverse() |
| 1807 | return lst |
| 1808 | |
| 1809 | def GetHeaderGuardCPPVariable(filename): |
| 1810 | """Returns the CPP variable that should be used as a header guard. |
no test coverage detected
searching dependent graphs…