Skip to content

Content Builder

Kamil "Enderek0" K edited this page Sep 7, 2025 · 2 revisions

ContentBuilder

This tool is used to automatically build a certain (user-defined) filestructure of your sourcemod (but also pretty much everything else that could use this).

Usage: Content Builder [-h] [-v] [-y] [-nl] [-dr | -nt] [-wd WD] [-t THREADS] config

positional arguments:

  • config - Path to the config file used to specify the tree structure.

options:

  • -h, --help - Show this help message and exit
  • -v, --verbose - Specify if the program should print out more information.
  • -y, --yes - Skip the confirmation dialog and immediately proceed to copy the files.
  • -nl, --nolog - Don't create log files.
  • -dr, --dryrun - Perform a dry run - don't actually copy the files, only print out the filestructure.
  • -nt, --notree - Skip performing the file tree calculations. Saves memory and time if you are certain the config is correct, as this won't show you the filestructure before exporting. --yes automatically sets this to true.
  • -wd WD, --working_dir WD - Override the working directory of the program (or set it, if it's not in the config).
  • -t THREADS, --threads THREADS - Maximum amount of threads this program can use. Default value is half of available threads.

Config file (.vdf)

This is a configuration file for the script. It defines what to export, what to not export, how to export, etc. Keys and values are case-insensitive, except for Paths, which are case-sensitive on Linux. The structure is as follows

filemanifest.json

"Config name" { // Set by the user, can be custom
    <base_options> // Base configuration options, see the "Base Functionality" page for more info

    "Export Dir" "export_out/"

    "Export" {
        <export_block> // See down below
    }

}

Export Dir

  • Directory where the program will export to.
  • Relative to the working directory of course.
  • Unless skip dialog is specified, a confirmation dialog will appear just before exporting, printing some of the filestructure to confirm it is what you want.

Export

  • This is a list of <export_block>s (explained below).
  • These blocks have an order! Meaning that they will get exported one by one, not all merged together.
    • The order is from top to bottom.
    • You can use that order for example to override specific files, for example gameinfo.txt which may be need to be different in the released build.

<export_block>

This is the actual block that contains most of the export information. Some paramaters are optional, but to some degree (explained below).

{
            "Relative Path" "game/"
            "Path"          "game/mymod"
            "Export all"    true

            "Blacklist" {
                "file" "blacklisted_file.extension"
                "file" "README.md"
                "dir" "somefolder"
                "regex" "*.vmx"
            }
            "Whitelist": {
                "file" "README.md"
            }
}

For the sake of explanation let's assume our mod filestructure is:

MyMod
├───deploy
│   ├───Build
│   └───buildscript
└───game
    ├───mymod
    └───other_stuff
        └───portal2_assets

Path

  • This specifies the directory which will be exported.
  • The path itself is relative to working directory.

Relative Path

  • This specifies how to relate the export dir to path.
  • This path itself is relative to working directory.
    • Given the example above, after the export the mymod folder will be copied over to Build, like so:
MyMod
├───deploy
│   ├───Build
|   |   └───mymod         <===== HERE
│   └───buildscript
└───game                 <== Relative to
    ├───mymod
    └───other_stuff
        └───portal2_assets
  • If the path would be game/other_stuff, then
MyMod
├───deploy
│   ├───Build
|   |   └───other_stuff          <=== HERE
|   |       └───portal2_assets
│   └───buildscript
└───game                       <== Relative to
    ├───mymod
    └───other_stuff
        └───portal2_assets
  • If path is game/other_stuff and relative path is game/other_stuff
MyMod
├───deploy
│   ├───Build
|   |   └───portal2_assets    <=== HERE
│   └───buildscript
└───game                       
    ├───mymod
    └───other_stuff            <== Relative to
        └───portal2_assets

Export All

  • Makes the program detect ALL of the files in path (recursively).
  • Optional (defaults to True)
  • Accepted values and their translations (case insensitive):
    • '0': False,
    • 'no': False,
    • 'false': False,
    • 'n': False,
    • 'f': False,
    • '1': True,
    • 'yes': True,
    • 'true': True,
    • 'y': True,
    • 't': True,

Whitelist

  • Specifies files that need to be exported.
  • Supports 3 targets (check below).
  • If Export All is set to false and whitelist is not specified, an error will occur (the program won't know what files to include)

Blacklist

  • Specifies files that won't be included in the export.
  • Supports 3 targets (check below).

Blacklist/Whitelist targets:

As a tip, check the export block structure above.

file

"file" "filepath"
  • This targets specific files. The path of the file is resolved as: {workingdir}/{path}/<filepath>, where:
    • {workingdir} is the working directory
    • {path} is the path parameter specified in this export block
    • <filepath> is the actual path in the file keyvalue

folders

"dir": "directory"
  • This targets folders and the subfolders of this folder. The path is resolved the same as in the file target explained above.
    • As seen above you can also target folders within folders, given the example above the program will completely omit temp and somefolder

regex

"regex" "*.vmx"
"regex" "something/**/*.jpg"
  • This targets files matching the specified regular expression. A simple usage is to target filetypes: *.filetype.

If you have any questions about this program, you can always open an issue.