Babelz / SaNi

2D game engine with a twist.
MIT License
6 stars 2 forks source link

Files may need some wrapping #6

Open siquel opened 9 years ago

siquel commented 9 years ago

FILE pointer

Could FILE pointer cause issues later on? Maybe implement cross platform FileStream class which does reading/writing and open them with FileSystem. FileSystem would be used only for creating, listing files, opening files, closing files etc, it would just return reference counted pointer to FileStream?

See sani/platform/binary_writer.cpp/.hpp and sani/platform/file_system.cpp/.hpp

LauriM commented 9 years ago

Yes, FILE should be wrapped. While it might work on like 99% of platforms, its easier to just wrap and make sure it works.

Simple struct should be enough to wrap it.

Also, it could be nice to wrap it with a bit more intelligent system than just a FILE*. Perhaps a struct that keeps also filesize, path + other info on it? (Extra stuff that could be nice)