reorder calls to fluid_file_test

This commit is contained in:
derselbst 2019-02-03 14:28:31 +01:00
parent ff6377a3bd
commit 12dd1c7653
3 changed files with 21 additions and 18 deletions

View file

@ -24,21 +24,26 @@
void *default_fopen(const char *path)
{
FILE* handle = FLUID_FOPEN(path, "rb");
FILE* handle;
if(handle == NULL)
if(!fluid_file_test(path, G_FILE_TEST_EXISTS))
{
FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Specified file does not exists or insufficient permissions to open it! ('%s')", path);
FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Unable to load non-existent file. ('%s')", path);
return NULL;
}
if(!fluid_file_test(path, G_FILE_TEST_IS_REGULAR))
{
FLUID_FCLOSE(handle);
FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Refusing to load non-regular file! ('%s')", path);
return NULL;
}
if((handle = FLUID_FOPEN(path, "rb")) == NULL)
{
FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Specified file does not exists or insufficient permissions to open it! ('%s')", path);
return NULL;
}
return handle;
}