Shared/IO/FileSystem.h file

Class Death::IO::FileSystem.

Namespaces

namespace Death
Shared root namespace.
namespace Death::IO
File system, streaming and IO-related classes.

Classes

class Death::IO::FileSystem
File system related methods.
class Death::IO::FileSystem::Directory
Handles directory traversal, should be used as iterator.
class Death::IO::FileSystem::MapDeleter
Memory-mapped file deleter.

Typedefs

using fs = FileSystem
Convenient shortcut to FileSystem.

Defines

#define DEATH_CASE_INSENSITIVE_FILESYSTEM
Whether the target's file system matches names case-insensitively.

Define documentation

#define DEATH_CASE_INSENSITIVE_FILESYSTEM

Whether the target's file system matches names case-insensitively.

Decides whether FileSystem::FindPathCaseInsensitive() has anything to do. Where this is defined the answer is already "the path as given", so the function is a pass-through and costs nothing; where it is not, the path has to be reconstructed one component at a time by enumerating each directory and comparing without case.

The consoles belong here for the same reason Windows® does - not by assumption, but because the file systems they actually read content from match without case:

  • The PlayStation®2 mounts its disc through cdfs, whose names are plain uppercase ISO 9660 (the disc image carries neither Rock Ridge nor Joliet), and lower-case paths open on it perfectly well.
  • The Dreamcast's fs_iso9660 compares with tolower() throughout and even lower-cases the names it reports back from a directory read.
  • The PSP, the Wii and the GameCube read their content from FAT volumes, which are case-insensitive by definition, a UMD or a disc is ISO 9660 like the above.

Doing the enumeration anyway would not just be wasted work on those, it would be expensive work: the walk only runs when the path was not found as given, which on a case-insensitive file system means it is not there under any spelling – and on optical media a lookup that misses costs a seek and a retry.

The PlayStation®3 is deliberately absent: nothing here establishes how its file system compares names, and the pass-through is only safe where that is known.