Skip to content

C++ class: FileSystem

Index · Français

Description

Static facade for native path operations.

Qualified name : gaspardos::FileSystem.

Header : bindings/cpp/gaspardos.hpp. C++98.

When to use it

Query or modify the filesystem without a stream.

Simple program example

#include "gaspardos.hpp"
#include <cstdio>
#include <cstring>

int main()
{
    GO64_FSInfo info = {};
    return gaspardos::FileSystem::stat(L"\\AHCIDISK0", info) == 0 ? 0 : 1;
}

Building from Windows

Save the program above as build/api-examples/FileSystem.cpp from the repository root. Create the directory if necessary.

PowerShell — from the repository root:

New-Item -ItemType Directory -Force build/api-examples | Out-Null
& .\build-x64-install\bin\x86_64-gaspardos-gcc.exe -std=gnu1x -O2 -mno-red-zone -c bindings/native/gaspardos_x64_syscall.c -o build/api-examples/syscall.o
if ($LASTEXITCODE -ne 0) { throw "C compilation failed" }
& .\build-x64-install\bin\x86_64-gaspardos-g++.exe -std=c++98 -O2 -Ibindings/cpp build/api-examples/FileSystem.cpp build/api-examples/syscall.o -o build/api-examples/FileSystem-x64.elf
if ($LASTEXITCODE -ne 0) { throw "C++ compilation/link failed" }

Run the ELF on GaspardOS, not Windows. The driver supplies CRT and libraries. Prepare the required volumes/services; examples bound their waits and may exit on backpressure rather than retry. Successful compilation does not validate kernel execution.

The headers, implementation files, native wrappers and complete examples are available under Source files.

Class methods

static int64_t stat(const wchar_t* path, GO64_FSInfo& info)

Fill path metadata.

static int64_t mkdir(const wchar_t* path)

Create a directory.

static int64_t unlink(const wchar_t* path)

Remove a file.

static int64_t rmdir(const wchar_t* path)

Remove a directory subject to kernel rules.

static int64_t rename(const wchar_t* from, const wchar_t* to)

Rename from to to; raw result, not errno.

Native contract

LP64 ABI, 32-bit wchar_t, no packing. Native negative results are not errno. Handle -11 with yield and an application limit. Referenced objects must outlive their users; do not copy handle owners. File uses stdio/errno and invalidates its stream on close, even on error.