-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the gm_mount wiki. Here you will find documentation for this module. For installation instructions and the like, see README.md in the repository. For example usage of this module (mounting Fistful of Frags!), scroll down.
mount.Mount(searchPath, pathID, appid (optional), PATH_ADD enum (optional))
This function is the main function in the module. It mounts a given searchPath to the game's virtual filesystem. The searchPath is relative to the steamapps/common/GarrysMod folder. You can think of the pathID as the second parameter to file.Find. The appid is the steam game's appid if what you are mounting is a steam game. The PATH_ADD enum will determine the priority of your path over others. For more information, read the Search Paths section of the Valve developer wiki's IFileSystem article.
NOTE (MAJOR GOTCHA) To fully mount a steam game, you must also mount its VPKs. See the example usage below. With the VPK mounting, file.Find DOES NOT list files/folders found in the root directory of the VPK, but they are still mounted. file.Find will however list files/folders inside any subdirectory of the VPK.
mount.Unmount(searchPath, pathID)
Unmounts the given searchPath in pathID.
Prints a list of all active search paths to the console.
FILESYSTEM_MOUNT
enums - returned from mount.Mount
Name | Value | Description |
---|---|---|
FILESYSTEM_MOUNT_OK |
0 | The mount operation was successful. |
FILESYSTEM_MOUNT_FAILED |
1 | The mount operation was unsuccessful. |
PATH_ADD
enums - used in mount.Mount
Name | Value | Description |
---|---|---|
PATH_ADD_TO_HEAD |
0 | Prioritize our content path over others. |
PATH_ADD_TO_TAIL |
1 | Prioritize other content paths over ours. |
This can be done in any state, I just did it from the menu state for convenience.
] lua_run_mn require("mount")
] lua_run_mn print(mount.Mount("../Fistful of Frags/fof", "fof", 265630, PATH_ADD_TO_TAIL))
0
] lua_run_mn print(mount.Mount("../Fistful of Frags/fof/fof_dir.vpk", "fof", 265630, PATH_ADD_TO_TAIL))
0
And here's what I'm talking about with the GOTCHA:
] lua_run_mn PrintTable(select(2, file.Find("*", "fof")))
blah blah...
6 = mapsrc
7 = materials
8 = media
9 = resource
etc...
] lua_run_mn PrintTable(select(2, file.Find("models/*", "fof")))
1 = bar
2 = elpaso
3 = hats
etc...
Note that there is no models subdirectory listed when I print the directories of the fof root, but it does exist and I can find files inside it.