Added SDL_CopyFile() and SDL_CopyStorageFile()

Fixes https://github.com/libsdl-org/SDL/issues/9553
This commit is contained in:
Sam Lantinga
2024-07-21 19:32:16 -07:00
parent 128df75e05
commit 033c9c5951
14 changed files with 213 additions and 0 deletions

View File

@@ -327,6 +327,18 @@ extern SDL_DECLSPEC int SDLCALL SDL_RemovePath(const char *path);
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
/**
* Copy a file.
*
* \param oldpath the old path.
* \param newpath the new path.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path.
*

View File

@@ -83,6 +83,9 @@ typedef struct SDL_StorageInterface
/* Rename a path, optional for read-only storage */
int (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
/* Copy a file, optional for read-only storage */
int (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
/* Get the space remaining, optional for read-only storage */
Uint64 (SDLCALL *space_remaining)(void *userdata);
} SDL_StorageInterface;
@@ -337,6 +340,21 @@ extern SDL_DECLSPEC int SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, cons
*/
extern SDL_DECLSPEC int SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Copy a file in a writable storage container.
*
* \param storage a storage container.
* \param oldpath the old path.
* \param newpath the new path.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC int SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path in a storage container.
*