MRI: Actually throw ENOENT for missing files #137
					 1 changed files with 14 additions and 1 deletions
				
			
		| 
						 | 
					@ -650,7 +650,20 @@ void FileSystem::openReadRaw(SDL_RWops &ops,
 | 
				
			||||||
                             bool freeOnClose)
 | 
					                             bool freeOnClose)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	PHYSFS_File *handle = PHYSFS_openRead(filename);
 | 
						PHYSFS_File *handle = PHYSFS_openRead(filename);
 | 
				
			||||||
	assert(handle);
 | 
					
 | 
				
			||||||
 | 
						if (!handle)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							PHYSFS_ErrorCode error = PHYSFS_getLastErrorCode();
 | 
				
			||||||
 | 
							switch (error)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							case PHYSFS_ERR_NOT_FOUND:
 | 
				
			||||||
 | 
							case PHYSFS_ERR_NOT_A_FILE:
 | 
				
			||||||
 | 
								throw Exception(Exception::NoFileError, "%s", filename);
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								throw Exception(Exception::PHYSFSError,
 | 
				
			||||||
 | 
								                "PhysFS: %s", PHYSFS_getErrorByCode(error));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	initReadOps(handle, ops, freeOnClose);
 | 
						initReadOps(handle, ops, freeOnClose);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue