Low-level abstract file system

BlitzMax Forums/BlitzMax Programming/Low-level abstract file system

JoshK(Posted 2007) [#1]
I am interested in implementing a really low-level abstract file system, so that everything automatically just works. The system I have set up already saves a lot of time. User can do this:

LoadTexture("materials\brick\brickwall01a.png")

Or they can simply go:

LoadTexture("brickwall01a")

This saves a lot of time and makes mesh file loading much easier, since I don't have to guess where the textures might be.

An even lower-level system that works with the TStream class would be even better, and it would be useful to everyone. Maybe some of the people here with more epxerience in this area can create a new streamfactory class that does this:

ReadFile("AFS://readme.txt")
Returns a stream from file "readme.txt" (obviously there can only be one file with that name)

ReadFile("AFS://readme")
Returns a stream from file "readme.*" (obviously there can only be one file with that name)

This would require an initialization step in which the user specified the root directory to load files from. Each directory could be scanned, and the stripped filenames stored in a TMap for fast retrieval. Their full filepath could be stored along with the shortened filename in a private type class.

The ultimate goal would be to have an abstract file register class so that extensions could be written for zip and other package formats. Then things like zipstream would just work without any special code.