SDL_RenamePath(3)
π SDL_RenamePath(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_RenamePath β yes, it does exactly what it says on the tin: it renames a file or directory. glow-up for your filesystem, no cap. β¨
πΈ NAME πΈ
SDL_RenamePath β rename a file or directory. that's it, that's the whole vibe. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_filesystem.h>
bool SDL_RenamePath(const char *oldpath, const char *newpath);
likeβ¦ two strings in, one bool out. she's simple, she's efficient, she's iconic. π
β¨ DESCRIPTION β¨
okay so here's the tea. if the file sitting at newpath already exists, it's getting replaced. not backed up, not merged, not asked politely β replaced. so maybe double-check before you go renaming things onto your precious files, bestie. π
also, important: this will not copy files across filesystems/drives/volumes. like, at all. because that would be a much more complicated (and possibly time-consuming) operation, and she is simply not doing all that. π«
which is to say β and I need you to hear me on this β if this function fails, there's a lil workaround you could try for files: SDL_CopyFile() to a temporary file in the same directory as newpath, then SDL_RenamePath() from the temporary file to newpath, and then SDL_RemovePath() on oldpath. that might work. might. π
renaming a non-empty directory across filesystems though? dramatically more complex. like, absolutely not, that's a whole other situation, we do not have the bandwidth. π
π§ FUNCTION PARAMETERS π§
oldpathβ the old path. the "before" pic. πΈnewpathβ the new path. the "after" pic. π
π RETURN VALUE π
returns true on success, or false on failure β and if it's a false, you gotta call SDL_GetError() for more information, because she will not explain herself unprompted. she's mysterious like that. π«Ά
π₯ THREAD SAFETY π₯
it is safe to call this function from any thread. go wild, multitask, live your best parallel life. β
π AVAILABILITY π
this function has been available since SDL 3.2.0. a legend from the jump. π
lowkey reminder: this one replaces stuff at newpath and does not cross filesystems/drives/volumes. be a responsible icon. π
and that's the whole page, bestie!! brought to you by Simple Directmedia Layer in all its SDL 3.4.18 glory β mwah, catch you in the next manpage. ππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms