{"id":18717027,"url":"https://github.com/stuart6854/gfs","last_synced_at":"2025-07-13T12:03:02.765Z","repository":{"id":208285272,"uuid":"721262381","full_name":"stuart6854/gfs","owner":"stuart6854","description":"gfs - C++17 Game (Virtual) Filesystem","archived":false,"fork":false,"pushed_at":"2024-01-12T21:31:31.000Z","size":1871,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T18:47:47.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stuart6854.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-11-20T17:31:35.000Z","updated_at":"2023-11-22T14:03:08.000Z","dependencies_parsed_at":"2024-01-13T01:15:52.027Z","dependency_job_id":"de181132-51eb-4742-975b-ee325a690642","html_url":"https://github.com/stuart6854/gfs","commit_stats":null,"previous_names":["stuart6854/gfs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stuart6854/gfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuart6854%2Fgfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuart6854%2Fgfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuart6854%2Fgfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuart6854%2Fgfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stuart6854","download_url":"https://codeload.github.com/stuart6854/gfs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuart6854%2Fgfs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265136988,"owners_count":23716778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T13:14:34.206Z","updated_at":"2025-07-13T12:03:02.746Z","avatar_url":"https://github.com/stuart6854.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GFS - Game (Virtual) Filesystem\n\n[![CMake Build](https://github.com/stuart6854/gfs/actions/workflows/cmake_build.yml/badge.svg?branch=main)](https://github.com/stuart6854/gfs/actions/workflows/cmake_build.yml)\n\n## Introduction\n\nA (virtual) filesystem designed to be used by games and game engines.\n\n### Features\n- Mount \u0026 Unmount directories\n- Create files under mounts with data\n- Read files inside of mounts using file ids\n- Iterate mounts \u0026 files\n- Optionally compress file data.\n- Combine multiple files into single archive files.\n\n## Requirements\n\n- C++17 capable compiler (MSVC, Clang++, G++)\n- CMake 3.15+\n\n## Usage\n\nThis project can either be compiled on its own or consumed as a submodule (CMake ```add_subdirectory```).\n\n## Example\n\nSee the `testbed` project for for an runnable example.\n\n```c++\ngfs::Filesystem fs;\n\n// Mount a directory that cannot be unmounted.\nMountID dataMount = fs.MountDir(\"data\"), false);\nif(dataMount == gfs::InvalidMountId)\n    std::cout \u003c\u003c \"Failed to mount data dir.\" \u003c\u003c std::endl;\n\n// Mount a directory that can be unmounted.\nMountID modsMount = fs.MountDir(\"mods\"), true);\nif(dataMount == gfs::InvalidMountId)\n    std::cout \u003c\u003c \"Failed to mount mods dir.\" \u003c\u003c std::endl;\n\n// Ummount a directory.\nbool wasUmounted = fs.Unmount(modsMount);\n\n// Iterate mounts \u0026 files.\nfs.ForeachMount([](const gfs::Filesystem::Mount\u0026 mount){});\nfs.ForeachFile([](const gfs::Filesystem::File\u0026 file){});\n\n/* Write new file */\nstruct SomeGameData : gfx::BinaryStreamable\n{\n    float time;\n    uint32_t x;\n    uint32_t y;\n\n    void Read(gfs::BinaryStreamRead\u0026 stream) override;\n    void Write(gfs::BinaryStreamWrite\u0026 stream) const override;\n}\nstd::filesystem::path filename = \"some_file.bin\";\nFileID newFileId = 98475845; // Could be random uint64 or hash of filepath.\nstd::vector\u003cFileId\u003e fileDependencies{};\nSomeGameData dataObj{};\nbool compressData = false; // File data can optionally be compressed using LZ4.\nbool wasWritten = fs.WriteFile(dataMount, filename, newFileId, fileDependencies, dataObj, compressData);\n\n/* Read file */\n// Reads the files data from the disk and writes to the passed `BinaryStreamable` object.\n// Compressed data will also be decompressed automatically.\nbool wasRead = fs.ReadFile(newFileId, dataObj);\n\n/* Create archive */\ngfs::MountID mountId = dataMount;\nstd::filesystem::path filename = \"archive_file.pbin\";\nstd::vector\u003cgfs::FileID\u003e files{ 98475845, 111, 222, 666 };\nbool wasCreated = fs.CreateArchive(mountId, filename, files);\n\n/* Import files */\nstruct MyImporter : gfs::FileImporter\n{\n    bool Import(gfs::Filesystem\u0026 fs, const std::filesystem::path\u0026 importFilename, gfs::MountID outputMount, const std::filesystem::path\u0026 outputDir) override\n\t{ \n        ...\n\t}\n\n\tbool Reimport(gfs::Filesystem\u0026 fs, const gfs::Filesystem::File\u0026 file) override \n    {\n        ...\n    }\n};\nfs.SetImporter({ \".txt\", \".ext\" }, std::make_shared\u003cMyImporter\u003e());\nbool wasImported = fs.Import(\"path/to/external/file.txt\", mountId, \"mount/rel/output/dir/\");\nbool wasReimported = fs.Reimport(fileId);\n\n``` \n\n## Planned Features\n\n- Add data compression threshold eg. only compress data greater than ~0.5MB","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuart6854%2Fgfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuart6854%2Fgfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuart6854%2Fgfs/lists"}