def path_inside_dir(path, directory):
    """
    Returns True if the specified @path is inside @directory,
    performing component-wide comparison. Otherwise returns False.
    """
    return directory == '' and path != '' or path.rstrip('/').startswith(
        directory.rstrip('/') + '/')
