# addDirectory
function addDirectory(system, directory)Add directory.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
directory | dynamic | — | directory value consumed by this operation. |
src/miniquake2/qcommon/filesystem.mlProvides miniquake2 qcommon filesystem facilities for this project.
miniquake2/qcommon/byteio.ml as bio → src/miniquake2/qcommon/byteio.mlminiquake2/qcommon/text.ml as text → src/miniquake2/qcommon/text.mlminiquake2/qcommon/types.ml as qt → src/miniquake2/qcommon/types.mlstd/fs.ml as fs → ../MiniLangCompilerML/std/fs.ml external dependencyfunction addDirectory(system, directory)Add directory.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
directory | dynamic | — | directory value consumed by this operation. |
function addGameDirectory(system, directory)Add game directory.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
directory | dynamic | — | directory value consumed by this operation. |
function addPack(system, filename)Add pack.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
filename | dynamic | — | filename value consumed by this operation. |
const BASE_DIRECTORY_NAME = "baseq2"Defines the base directory name constant used by the miniquake2 qcommon filesystem module.
function canonicalVirtualName(name)Resolve dot segments inside the virtual root. Historical retail PAKs contain names such as models/monsters/tank/../ctank/skin.pcx; they are safe once canonicalized, while attempts to walk above the virtual root remain errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | dynamic | — | Name of the affected item. |
extern function CloseHandle(handle as ptr) from "kernel32.dll" returns boolInvokes the native CloseHandle entry point used by the miniquake2 qcommon filesystem module.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle | ptr | — | Native or runtime handle used by the operation. |
Returns: Native bool result produced by the call.
function create(baseDirectory, gameDirectory)Creates create for the miniquake2 qcommon filesystem module.
| Parameter | Type | Default | Description |
|---|---|---|---|
baseDirectory | dynamic | — | baseDirectory value consumed by this operation. |
gameDirectory | dynamic | — | gameDirectory value consumed by this operation. |
extern function CreateFileW(path as wstr, access as int, share as int, security as ptr, creation as int, flags as int, template as ptr) from "kernel32.dll" returns ptrInvokes the native CreateFileW entry point used by the miniquake2 qcommon filesystem module.
| Parameter | Type | Default | Description |
|---|---|---|---|
path | wstr | — | Path of the file or directory used by the operation. |
access | int | — | access value consumed by this operation. |
share | int | — | share value consumed by this operation. |
security | ptr | — | security value consumed by this operation. |
creation | int | — | creation value consumed by this operation. |
flags | int | — | Bit flags controlling the operation. |
template | ptr | — | template value consumed by this operation. |
Returns: Native ptr result produced by the call.
function fileExists(system, name)Return the file exists value.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
name | dynamic | — | Name of the affected item. |
function findPackFile(pack, name)Find pack file.
| Parameter | Type | Default | Description |
|---|---|---|---|
pack | dynamic | — | pack value consumed by this operation. |
name | dynamic | — | Name of the affected item. |
extern function GetFileSizeEx(handle as ptr, size as bytes) from "kernel32.dll" returns boolInvokes the native GetFileSizeEx entry point used by the miniquake2 qcommon filesystem module.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle | ptr | — | Native or runtime handle used by the operation. |
size | bytes | — | Size in the units required by the operation. |
Returns: Native bool result produced by the call.
function initialize(baseDirectory, gameDirectory)Performs the initialize operation for the miniquake2 qcommon filesystem module.
| Parameter | Type | Default | Description |
|---|---|---|---|
baseDirectory | dynamic | — | baseDirectory value consumed by this operation. |
gameDirectory | dynamic | — | gameDirectory value consumed by this operation. |
function loadPack(filename)Load pack.
| Parameter | Type | Default | Description |
|---|---|---|---|
filename | dynamic | — | filename value consumed by this operation. |
const MAX_FILES_IN_PACK = 4096Defines the max files in pack constant used by the miniquake2 qcommon filesystem module.
function musicTrackName(track)Return the music track name.
| Parameter | Type | Default | Description |
|---|---|---|---|
track | dynamic | — | track value consumed by this operation. |
function musicTrackPath(system, track)Prefer loose files so the native Vorbis bridge owns compressed retail data without retaining a multi-megabyte MiniLang byte array for the whole level. The 2023 Steam release stores the original soundtrack below rerelease/baseq2/music while classic source ports commonly use baseq2/music. PAK-contained replacements remain available through readFile.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
track | dynamic | — | track value consumed by this operation. |
function normalizeVirtualName(name)Normalize virtual name.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | dynamic | — | Name of the affected item. |
const PACK_LOOKUP_SIZE = 8192Defines the pack lookup size constant used by the miniquake2 qcommon filesystem module.
inline function packLookupSlot(name)Return the deterministic open-addressing slot for a canonical PAK name.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | dynamic | — | Name of the affected item. |
function parsePack(data, filename)Parse pack.
| Parameter | Type | Default | Description |
|---|---|---|---|
data | dynamic | — | Input data consumed by the operation. |
filename | dynamic | — | filename value consumed by this operation. |
extern function ReadFile(handle as ptr, buffer as bytes, count as int, bytesRead as bytes, overlapped as ptr) from "kernel32.dll" returns boolInvokes the native ReadFile entry point used by the miniquake2 qcommon filesystem module.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle | ptr | — | Native or runtime handle used by the operation. |
buffer | bytes | — | Buffer that receives or supplies the operation data. |
count | int | — | Number of items or units to process. |
bytesRead | bytes | — | bytesRead value consumed by this operation. |
overlapped | ptr | — | overlapped value consumed by this operation. |
Returns: Native bool result produced by the call.
function readFile(system, name)Read file.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
name | dynamic | — | Name of the affected item. |
function readMusicTrack(system, track)Read music track.
| Parameter | Type | Default | Description |
|---|---|---|---|
system | dynamic | — | system value consumed by this operation. |
track | dynamic | — | track value consumed by this operation. |
function virtualNameValid(name)Report whether virtual name valid.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | dynamic | — | Name of the affected item. |