Ensure the path is a dir path.

        Should end with '/' except for schemes and locators.

        Args:
            path (str): Path or URL.
            relative (bool): Path is relative to current root.

        Returns:
            path: dir path
180925
def ensure_dir_path(self, path, relative=False):
        
        if not relative:
            rel_path = self.relpath(path)
        else:
            rel_path = path

        # Locator
        if self.is_locator(rel_path, relative=True):
            path = path.rstrip('/')

        # Directory
        elif rel_path:
            path = path.rstrip('/') + '/'
        # else: root
        return path
1219937
def is_valid_dir(path):
    '''  '''
    return os.path.exists(path) and os.path.isdir(path)
301488
def _absolute_path(path, relative_to=None):
    '''
    
    '''

    if path and os.path.isabs(path):
        return path
    if path and relative_to is not None:
        _abspath = os.path.join(relative_to, path)
        if os.path.isfile(_abspath):
            log.debug(
                'Relative path \'%s\' converted to existing absolute path '
                '\'%s\'', path, _abspath
            )
            return _abspath
    return path
1107577
def check_directory_path(self, path):
        
        if os.path.isdir(path) is not True:
            msg = "Directory Does Not Exist {}".format(path)
            raise OSError(msg)
785400
def isdir(path):
    
    system = get_instance(path)

    # User may use directory path without trailing '/'
    # like on standard file systems
    return system.isdir(system.ensure_dir_path(path))
913834
def _valid_directory(self, path):
        
        abspath = os.path.abspath(path)
        if not os.path.isdir(abspath):
            raise argparse.ArgumentTypeError('Not a valid directory: {}'.format(abspath))
        return abspath
1303129
def parent_dir(path):
    ''''''
    return os.path.abspath(os.path.join(path, os.pardir, os.pardir, '_build'))
877838
def return_abs_path(directory, path):
    
    if directory is None or path is None:
        return
    directory = os.path.expanduser(directory)
    return os.path.abspath(os.path.join(directory, path))
993342
def get_repo_parent(path):
    
    # path is a repository
    if is_repo(path):
        return Local(path)

    # path is inside a repository
    elif not os.path.isdir(path):
        _rel = ''
        while path and path != '/':
            if is_repo(path):
                return Local(path)
            else:
                _rel = os.path.join(os.path.basename(path), _rel)
                path = os.path.dirname(path)
        return path
1330465
def _relativePath(self, fullPath):
        
        if fullPath is None:
            return None

        assert fullPath.startswith("/"), fullPath

        path = os.path.relpath(fullPath, self.userPath)

        if not path.startswith("../"):
            return path
        elif self.ignoreExtraVolumes:
            return None
        else:
            return fullPath
303568
def ensure_dir(path):
    
    os.makedirs(os.path.abspath(os.path.dirname(path)), exist_ok=True)
897216
def ensure_dir(path):
    
    dirpath = os.path.dirname(path)
    if dirpath and not os.path.exists(dirpath):
        os.makedirs(dirpath)
1076358
def abspath(self, path):
        '''
        
        '''
        if not path.startswith(os.path.sep) or path.startswith('~'):
            path = os.path.expanduser(os.path.join(self.base_path, path))
        return path
534072
def get_abs_path(relative_path):
    
    abs_path = os.path.sep.join(
        os.path.abspath(sys.modules[__name__].__file__).split(os.path.sep)[:-1])
    abs_path = os.path.abspath(abs_path + os.path.sep + relative_path)
    return abs_path
1336281
def cont_path(self, path):
        
        if path.startswith("/"):
            path = path[1:]
        real_path = os.path.join(self.mount_point, path)
        logger.debug("path = %s", real_path)
        return real_path
122147
def is_directory(self, path):
        '''

        '''
        node = self.get_node(path)
        if not node:
            return False
        return node.is_directory
1261954
def relative_to_local_path(path)
      if path && path.length > 0
        case_insensitive_join(local_path, path)
      else
        case_insensitive_resolve(local_path)
      end
    end