Table of Contents

Class ContentPath

Namespace
BSGameLib.Game
Assembly
BSGameLib.Game.dll

Resolves a content path that may not match the on-disk case of its folders or file name.

public static class ContentPath
Inheritance
ContentPath
Inherited Members

Remarks

Game content is very often authored on Windows, where the filesystem is case-insensitive, and then shipped to Linux, where it is not. The failure is silent and per-file: a folder of fifty assets loads fine except the handful somebody happened to save with a capital letter. That is not a content bug worth punishing a player for, so a miss falls back to a case-insensitive match on each folder and then the file name, as Windows would have made it.

The scan result is cached per directory, so this costs one enumeration per directory that ever misses -- not one per lookup.

Methods

InvalidateCache()

Drops the cached directory listings. Only needed if content is written to disk at runtime -- a downloaded custom asset, say -- after a lookup in that directory has missed.

public static void InvalidateCache()

Resolve(string)

Returns path if it exists, otherwise the path to the same entry with its folders and file name differing only by case, otherwise path unchanged so the caller reports the miss against the path it actually asked for.

public static string Resolve(string path)

Parameters

path string

Returns

string