Skip to content

Auto-mount archive next to the executable #33

@RobLoach

Description

@RobLoach

Summary

Add an InitPhysFSAuto() (or similar) helper that automatically searches for and mounts a default archive without the caller having to figure out the path. This mirrors the convention used by LÖVE, SDL-based games, and several other engines, and removes a chunk of boilerplate from typical raylib game startup code.

Proposed behavior

Given a filename like "data.zip", search in this order and mount the first hit:

  1. Next to the running executable (use raylib's GetApplicationDirectory()).
  2. The current working directory.
  3. A loose folder of the same base name (e.g. data/) for development builds where assets aren't packed yet.

If none are found, return false and let the caller decide what to do.

Proposed API

bool InitPhysFSAuto(const char* archiveName, const char* mountPoint);
  • archiveName — e.g. "data.zip". May be NULL to fall back to a default.
  • mountPoint — passed through to PhysFS, may be NULL for root.

Why

  • Removes the most common ~10 lines of "figure out where my assets live" code from every project that uses this library.
  • Makes "ship a single executable + zip" workflows trivial.
  • Keeps dev-mode (loose folder) and release-mode (zip) using the same code path.

Notes

  • Should respect RAYLIB_PHYSFS_PLATFORM_RAYLIB so it works on platforms where raylib provides its own file I/O.
  • Consider also exposing the resolved path via an out-parameter for logging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions