set_allegro_resource_path(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ set_allegro_resource_path ✨

okay bestie, gather round, we're talking about set_allegro_resource_path from the Allegro manual β€” the one and only Allegro game programming library πŸ’– (this is page set_allegro_resource_path(3) if you're keeping track, which you should be, iykyk).


🌸 SYNOPSIS 🌸

#include <allegro.h>

int set_allegro_resource_path(int priority, const char *path);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like… sometimes Allegro just does NOT look in enough places to find a resource 😭 and honestly? same. for those special little situations, you call this function before you load your resource, and you hand it some extra paths to search. obsessed with the flexibility fr fr.

you set up the priorities, and here's the tea: higher numbers get searched for first πŸ‘‘ so like, most important path = biggest number, periodt.

want to modify a path you already set up? easy, just call this function again with the same priority and the new path. slay.

want to remove an already setup path? call it with the priority of that path and NULL as the path parameter. bye bestie πŸ’…

example time, look how cute:

set_allegro_resource_path(10, "my_game/configs");
set_allegro_resource_path(0, "users/configs/");
set_allegro_resource_path(-45, "temp");
note the -45?? yes, negative priorities are a thing, she contains multitudes 🌈

these custom paths will be valid until you call allegro_exit(). and yes, you can call this function before install_allegro(), but β€” important β€” after set_uformat() if you want to use a text encoding format other than the default. don't skip that step, it's giving order matters πŸ™ˆ


πŸ’œ RETURN VALUE πŸ’œ

  • Returns non-zero on success πŸŽ‰
  • Returns zero if the path could not be added, or if you wanted to remove a path and the priority you used didn't have any associated path (aka nothing was there to delete, awkward πŸ’€)
  • Modification of existing paths always succeeds. no cap, always.

⭐ SEE ALSO ⭐


and that's the whole page, bestie!! this was Allegro version 4.4.3, from your girl set_allegro_resource_path(3) β€” go find those resources, you got this πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from