Hey So i’m wondering how multi-platform games like minecraft are able to create directories that are visible as folders and such where they can store saves or other resources?
If you know how to do this in a Boost::Filesystem related way, answer this post.
In the case of Minecraft, it’s in Java, which abstracts out the file system handling so that a call to something like CreateDirectory() will work on any OS without having to re-write the basic function call. This is because Java runs on top of a virtual machine (the JVM), and the JVM handles the OS specific calls to deal with the file system. Such is the advantage of Java. Most interpreted languages (as well as Just In Time complied languages) work in this manner, since they can abstract the OS specific file system commands away from the programmer.
That said, with something like C++, which is complied for a specific architecture, the problem is more complex. Each OS can have a different set of functions to handle file and directory manipulation, and for games that are ported to a different platform, this is often one of the things that gets changed when doing the port. In this case, libraries such as Boost are helpful, as they allow for the same sort of abstraction as some other languages. If the game doesn’t use Boost, then often the programmer will still write a library of sorts, usually for reasons of reuse and readability.