Revision Difference
File_Search_Paths#565745
<cat>Dev.Ref</cat>
# File Search Paths
Here is a list of file search paths for use by the <page>file</page> library.
| Search Path | Description |
| -------------- |
| "GAME" | Structured like base folder (`garrysmod/`), searches all the mounted content (main folder, addons, mounted games, etc) |
| "LUA" | Automatically selects `lcl`, `lsv` or `LuaMenu` based on current realm. |
| "lcl" | All Lua files and subfolders (`lua/`) visible to the client <page text="state">States</page>. |
| "lsv" | All Lua files and subfolders (`lua/`) visible to the server <page text="state">States</page>. |
| "LuaMenu" | All Lua files and subfolders (`lua/`) visible to the menu <page text="state">States</page>. |
| "DATA" | Data folder (`garrysmod/data/`). `garrysmod/data_static/` is NOT included. |
| "DATA" | Data folder (`garrysmod/data/`). `garrysmod/data_static/` is NOT included, use `GAME` for this. |
| "DOWNLOAD" | Downloads folder (`garrysmod/download/`) |
| "garrysmod" & "MOD" | Strictly the game folder (`garrysmod/`), ignores mounting such as addons, mountable games and VPK contents. |
| "BASE_PATH" | Location of the root folder (where `gmod.exe`, `bin/` and etc. are) |
| "EXECUTABLE_PATH" | `bin/` folder and root folder |
| "MOD_WRITE", "GAME_WRITE" & "DEFAULT_WRITE_PATH" | Strictly the game folder, meant for writing files (`garrysmod/`) |
| "THIRDPARTY" | Contains content from installed addons or gamemodes, relative to `garrysmod/` like `GAME` path is. |
| "WORKSHOP" | Contains only the content from workshop addons. This includes all mounted `.gma` files, even floating ones. |
| "BSP" | Only the files embedded in the currently loaded map (`.bsp` lump 40) |
| "GAMEBIN" | Location of the folder containing important game files. (On Windows: `garrysmod/bin/` on Linux: `bin/linux32` or `bin/linux64`) |
| <mounted folder> | Strictly within the folder of a mounted game specified, e.g. `"cstrike"`, see note below |
| <mounted Workshop addon title> | Strictly within the specified Workshop addon. See <page>engine.GetAddons</page>.<br/><br/>For GMA files, this will be the [title embedded inside the GMA file itself](https://github.com/Facepunch/garrysmod-issues/issues/5143#issuecomment-1014786514), not the title of the Workshop addon it was downloaded from. |
Mounted games also get their own Search Path. Examples:
| Search Path | Game |
| -------------- |
| "cstrike" | Counter-Strike Source |
| "hl2" | Half-Life 2 |
| "tf" | Team Fortress 2 |
# Listing all active search paths in-game
Garry's Mod provide a useful command that lists all currently active search paths for the current game state:
`path`
The command will out text like this:
```
---------------
Paths:
--- ENGINECORE ---
"path_to_folder1" "EXECUTABLE_PATH"
"path_to_folder2" "BASE_PATH"
"path_to_folder3" "GAMEBIN"
"path_to_folder4" "LOGDIR"
...
--- GAMECONTENT ---
"path_to_vpk1" "GAME" (VPK)
"path_to_vpk2" "hl2" (VPK)
"path_to_vpk3" "GAME" (VPK)
"path_to_vpk4" "cstrike" (VPK)
```
Each line will contain the real filesystem path and its Search Path designation that can be used with the <page>file</page> library.
This may also be useful for general debugging. Content from paths that appear first will override content from paths that appear last.
Garry's Mod
Rust
Steamworks
Wiki Help