make_absolute_filename(3alleg4)

✨ make_absolute_filename ✨

okay bestie, we're in the Allegro manual and this one is literally called make_absolute_filename β€” she takes a path and a relative filename and hands you back a whole absolute filename. Allegro game programming library energy πŸ’–


🌸 SYNOPSIS 🌸

#include <allegro.h>

char *make_absolute_filename(char *dest, const char *path, const char
*filename, int size);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: you've got an absolute path, you've got a relative filename, and you want them to be one single absolute filename. That's her. That's the whole job. πŸ’…

She stores at most size bytes into the dest buffer β€” so like, size is the limit, not a suggestion, don't be messy about it.

And ngl, this is basically calling replace_filename() and then canonicalize_filename() β€” like, that's the exact relationship. If you already know those two, you already know her. iykyk 🫢

Example, because we love a concrete moment:

char buf[256];
...
make_absolute_filename(buf, "/usr/games/",
                       "../temp.txt", sizeof(buf));
/* This would create /usr/temp.txt */

See how the .. got handled? That's the canonicalize part doing her thing. ✨


πŸŽ€ RETURN VALUE πŸŽ€

Returns a copy of the dest parameter. That's it, that's the tea. She gives you back dest. πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘


okay so that's the whole page, no cap, every flag and function signature preserved because we do not play fast and loose with documentation πŸ’œ

This was Allegro, version 4.4.3 β€” go forth and build them absolute filenames, bestie, you're gonna slay πŸ¦‹πŸ’–πŸŒΈ