carputils
Doxygen code documentation for the python framework controlling openCARP
Functions
carputils.bundle.path_utils Namespace Reference

Functions

def os_path_split_asunder (path)
 http://stackoverflow.com/a/4580931/171094 More...
 
def is_subdirectory (potential_subdirectory, expected_parent_directory)
 Is the first argument a sub-directory of the second argument? More...
 

Function Documentation

◆ is_subdirectory()

def carputils.bundle.path_utils.is_subdirectory (   potential_subdirectory,
  expected_parent_directory 
)

Is the first argument a sub-directory of the second argument?

Parameters
potential_subdirectory
expected_parent_directory
Returns
True if the potential_subdirectory is a child of the expected parent directory
>>> is_subdirectory('/var/test2', '/var/test')
False
>>> is_subdirectory('/var/test', '/var/test2')
False
>>> is_subdirectory('var/test2', 'var/test')
False
>>> is_subdirectory('var/test', 'var/test2')
False
>>> is_subdirectory('/var/test/sub', '/var/test')
True
>>> is_subdirectory('/var/test', '/var/test/sub')
False
>>> is_subdirectory('var/test/sub', 'var/test')
True
>>> is_subdirectory('var/test', 'var/test')
True
>>> is_subdirectory('var/test', 'var/test/fake_sub/..')
True
>>> is_subdirectory('var/test/sub/sub2/sub3/../..', 'var/test')
True
>>> is_subdirectory('var/test/sub', 'var/test/fake_sub/..')
True
>>> is_subdirectory('var/test', 'var/test/sub')
False

◆ os_path_split_asunder()

def carputils.bundle.path_utils.os_path_split_asunder (   path)