INNER CODE UNIT · Python

path

ivoyager/planetarium · web/post_export.py:83

        path = EXPORT_DIR / (name + ending)
        if not path.is_file() and not path.with_name(path.name + ".gz").is_file():
            missing_files.append(path.name)
    htaccess_path = EXPORT_DIR / HTACCESS
    if (not htaccess_path.is_file()
            or HTACCESS_GZIP_LINE not in htaccess_path.read_text(encoding="utf-8")):
        missing_files.append("the .htaccess in web/README.md")
    return missing_files


def add_splash_image(name):
    shutil.copyfile(SPLASH_IMAGE, EXPORT_DIR / SPLASH_IMAGE.name)
    worker_path = EXPORT_DIR / (name + ".service.worker.js")
    with open(worker_path, encoding="utf-8", newline="") as file:
        worker = file.read()
    match = re.search(r"^const CACHED_FILES = (\[.*?\]);", worker, flags=re.MULTILINE)
    if not match:
        sys.exit(f"ERROR: found no CACHED_FILES array in {worker_path}.")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…