[hatari-devel] Replacing direct file system access with an abstraction layer?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


I recently created a new adaptation of Hatari as a Libretro core (an alternative to the existing libretro/hatari), and in an Atari Forum discussion Eero Tamminen suggested it might be worth incorporating some of the adaptations I had to make into the main project.

Atari Forum thread: https://www.atari-forum.com/viewtopic.php?p=450412#p450412
My adaptation: https://github.com/bbbradsmith/hatariB

In my adaptation I had to find and replace (or remove) every direct use of the filesystem. I replaced fopen, fseek, ftell, fseeko, ftello, scandir, stat, etc. with an abstract replacement interface provided by my core, which itself was a wrapper around Libretro's virtual file system interface)

Would it be worthwhile and/or desirable to do this for main Hatari? Essentially the idea is to create an abstraction interface in Hatari's file.h, and use it to replace all existing direct filesystem calls. File_fopen, File_ftell, File_stat, etc.

I hadn't initially considered it, since I don't see the direct file system use as a problem for the stand-alone application, but maybe it would make it easier for other adaptations like mine where the standard file system is not available? It may also just be useful to consolidate all the file system use in one place like this for purposes of debugging and diagnostics.

So, that's the proposal. I think there's some potential benefits, but I didn't want to do the work of preparing a PR for this unless I first understood that it was wanted.

In my own adaptation I already had to do the work of finding and replacing them all, so for that alone it's probably just extra work rather than a benefit... though at least it could remove ~100 points of change vs. the main source, which would be nice. However, I'd be happy to do it if others think it would be a good change to have in the main project.

So, is that worth doing? Would anyone here want to see this change?

-- Brad Smith



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/