Source code for pyicat_plus.utils.path_utils
import os
[docs]
def basename(path: str) -> str:
while path and not os.path.basename(path):
path = os.path.dirname(path)
return os.path.basename(path)
[docs]
def dirname(path: str) -> str:
while path and not os.path.basename(path):
path = os.path.dirname(path)
return os.path.dirname(path)
[docs]
def split(path: str) -> str:
while path and not os.path.basename(path):
path = os.path.dirname(path)
return path.split(os.sep)
[docs]
def markdir(path: str) -> str:
if path and os.path.basename(path):
path = os.path.join(path, "")
return path