Refactor endsWith() to not use the STL

There's not really any reason for this function to use heap-allocated
strings. So I've refactored it to not do that.

I would've used SDL_strrstr(), if it existed. It does not appear to
exist. But that's okay.
This commit is contained in:
Misa
2021-02-26 15:29:37 -08:00
committed by Ethan Lee
parent 3171a97160
commit 5d4c1b7e9d
4 changed files with 11 additions and 11 deletions

View File

@@ -204,7 +204,7 @@ void FILESYSTEM_mountassets(const char* path)
FILESYSTEM_mount(zippath.c_str());
graphics.reloadresources();
FILESYSTEM_assetsmounted = true;
} else if (zip_path != "data.zip" && !endsWith(zip_path, "/data.zip") && endsWith(zip_path, ".zip")) {
} else if (zip_path != "data.zip" && !endsWith(zip_path.c_str(), "/data.zip") && endsWith(zip_path.c_str(), ".zip")) {
printf("Custom asset directory is .zip at %s\n", zip_path.c_str());
PHYSFS_File* zip = PHYSFS_openRead(zip_path.c_str());
zip_path += ".data.zip";