INNER CODE UNIT · Python

amalgamate

SpartanJ/eepp · projects/scripts/amalgamate.py:12

def amalgamate(file_path, search_paths, current_file_dir):
    # 1. Check relative to current file, 2. Check global search paths
    potential_paths = [os.path.join(current_file_dir, file_path)] + [
        os.path.join(sp, file_path) for sp in search_paths
    ]

    resolved_path = None
    for p in potential_paths:
        abs_p = os.path.abspath(p)
        if os.path.exists(abs_p):
            resolved_path = abs_p
            break

    if not resolved_path:
        return None

    if resolved_path in visited_files:
        return f"// [Already included: {file_path}]\n"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…