RobLoach / RobLoach/raylib-physfs

Auto-mount archive next to the executable

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
50
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing PhysFS initialization entry points and the platform-specific path handling controlled by RAYLIB_PHYSFS_PLATFORM_RAYLIB. Verify how raylib's GetApplicationDirectory() and current-directory checks can support the requested search order, then confirm completion with archive, loose-folder, NULL-argument, mount-point, and not-found cases; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.