1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 01:29: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_copyFile(const char *oldLocation, const char *newLocation);
void FILESYSTEM_init(char *argvZero)
int FILESYSTEM_init(char *argvZero)
{
char output[MAX_PATH];
int mkdirResult;
@ -78,6 +78,11 @@ void FILESYSTEM_init(char *argvZero)
#endif
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_MESSAGEBOX_ERROR,
"data.zip missing!",
@ -86,7 +91,9 @@ void FILESYSTEM_init(char *argvZero)
"\nor get it from the free Make and Play Edition.",
NULL
);
return 0;
}
return 1;
}
void FILESYSTEM_deinit()

View file

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

View file

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