Add SDL3 as a platform#116
Conversation
|
I've actually been thinking of doing this for awhile, honestly. I'll look at this more closely in the morning (and probably merge it). |
|
Sounds good with me. I ran it through my own test suite, and things seem to be working, but feel free to change anything around. Some thoughts...
Overall though, it seemed to be pretty solid. |
| * | ||
| * When finished, the result will need SDL_free(). | ||
| */ | ||
| static char *platformCopyWithSeparator(const char *path) |
There was a problem hiding this comment.
SDL_GetUserFolder, SDL_GetBasePath, and SDL_GetPrefPath all promise the returned string will end with a path separator, so this function probably can go away in favor of a call to __PHYSFS_strdup().
There was a problem hiding this comment.
The only difference I found between them was that on SDL_GetPrefPath(), we don't need to call __PHYSFS_strdup() since it allocs the memory for us, while the others don't. Should be good now. Thanks!
| /** | ||
| * Ignores any issued SDL errors prior to sending the report off to PhysFS. | ||
| * | ||
| * This ensures we don't pollute SDL_GetError(). |
There was a problem hiding this comment.
I think it's fine to pollute SDL_GetError(). If one didn't query the string immediately upon return from a failing SDL API call, it's not reasonable to assume it didn't get replaced by something else (including a PhysicsFS that was explicitly built to use SDL under the hood).
There was a problem hiding this comment.
Removed SDL_BAIL_IF entirely. Does clean it up.
This adds SDL3 as a platform to allow using the SDL3 File System when interacting with PhysFS. I'm not 100% sure this is a good idea, so let me know if this is a backwards approach.
Since the platform changes across SDL builds, I've exposed a
PHYSFS_PLATFORM_SDL3CMake option to allow explicitly stating that you want to target SDL3 instead of one of the other platforms.