1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

actually return an error when data.zip is missing

We should return an error code when we can't find data.zip, just letting
the program crash is a little crude.
This commit is contained in:
Christoph Böhmwalder 2020-01-10 22:04:04 +01:00 committed by Ethan Lee
parent 3b66877287
commit 3a961310ca
3 changed files with 13 additions and 3 deletions

View file

@ -32,7 +32,7 @@ void PLATFORM_getOSDirectory(char* output);
void PLATFORM_migrateSaveData(char* output); void PLATFORM_migrateSaveData(char* output);
void PLATFORM_copyFile(const char *oldLocation, const char *newLocation); void PLATFORM_copyFile(const char *oldLocation, const char *newLocation);
void FILESYSTEM_init(char *argvZero) int FILESYSTEM_init(char *argvZero)
{ {
char output[MAX_PATH]; char output[MAX_PATH];
int mkdirResult; int mkdirResult;
@ -78,6 +78,11 @@ void FILESYSTEM_init(char *argvZero)
#endif #endif
if (!PHYSFS_mount(output, NULL, 1)) if (!PHYSFS_mount(output, NULL, 1))
{ {
puts("Error: data.zip missing!");
puts("You do not have data.zip!");
puts("Grab it from your purchased copy of the game,");
puts("or get it from the free Make and Play Edition.");
SDL_ShowSimpleMessageBox( SDL_ShowSimpleMessageBox(
SDL_MESSAGEBOX_ERROR, SDL_MESSAGEBOX_ERROR,
"data.zip missing!", "data.zip missing!",
@ -86,7 +91,9 @@ void FILESYSTEM_init(char *argvZero)
"\nor get it from the free Make and Play Edition.", "\nor get it from the free Make and Play Edition.",
NULL NULL
); );
return 0;
} }
return 1;
} }
void FILESYSTEM_deinit() void FILESYSTEM_deinit()

View file

@ -4,7 +4,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
void FILESYSTEM_init(char *argvZero); int FILESYSTEM_init(char *argvZero);
void FILESYSTEM_deinit(); void FILESYSTEM_deinit();
char *FILESYSTEM_getUserSaveDirectory(); char *FILESYSTEM_getUserSaveDirectory();

View file

@ -36,7 +36,10 @@ scriptclass script;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
FILESYSTEM_init(argv[0]); if(!FILESYSTEM_init(argv[0]))
{
return 1;
}
SDL_Init( SDL_Init(
SDL_INIT_VIDEO | SDL_INIT_VIDEO |
SDL_INIT_AUDIO | SDL_INIT_AUDIO |