How to make a list of resource files that must be put on FastDL server?

Hi, I need help to build a list of server’s downloadable resource files, so I can use this list to copy those files on the FastDL server.

I saw the function GetDownloadables(), and tried to use it but it doesn’t seem to work at all for me (please provide a working example if you can).

Please don’t suggest me to use SourceRSC, we have only 1Gb on our FastDL server so I don’t want to waste space by copying every models, sounds etc. I want to copy only files that are used by resource.Add* functions.

Also, I could delete my gmod folder, let it rebuild when I start gmod, make a copy of that fresh folder, join the server with FastDL disabled, download files, then compare those 2 folders to see which files were downloaded…

But do you have an easier way?


Help please, I would like to know your methods for uploading only needed files to FastDL.

I’m not sure if this is any help, but when you are adding files to resource.Add, it isn’t as daunting as it might appear. First of all, most large addons (such as Wiremod) will come with a built in resource.AddFile function, so you don’t need to add anything associated with them, if such a file is present. Basically just scan through the addons you have on the server, and jot down which ones need to be added (it shouldn’t be an awful lot). Then go through sounds, models etc. and do the same. Then just enter them into your own .lua file in lua/autorun/server and that should do it. If you’re not sure or you’re too lazy of which ones you need, then just start your server with no files added to the function, and see which things are missing (when joining your server though, you need to create a new garrysmod folder and rename your old one to make a fresh copy).
Unfortunately there is no “easy” way to do this, but hopefully this will help you!

local oldres = resource.AddFile
MyHugeTable = {}

function resource.AddFile(f)
table.insert(MyHugeTable, f)

Make sure this is run before any other add-on that uses the function. The table MyHugeTable contains all filepaths.

Yes that’s what I do (honestly, I had this idea right after I posted…), just a little more complex, I will post what I have once it’s working as I want.

I just use the content folder setup in the gamemode, and use recursion in command prompt to bzip it all, then I upload. It’s pretty organized and never really needed another way. I also use gm_cmd to update the cache automatically.

What if you have to migrate to a new server and need to upload all of the add-ons’ materials / sounds / etc?

Then I just re-upload?

I have the content backed up on my computer of course.

Thanks for gm_cmd, I will try this but I’m not sure if the Windows’s FTP commands are working as they should…

I may have a working script soon (or not), that automatically upload every Downloadables and cache file(s) to the FastDL server (if they doesn’t already exist of course), also features removing useless files from FastDL, bzipping files greater than X kb, and a blacklist so you can disallow files to be added to the Downloadables list… but I don’t have too much free time for the moment and I have some problems with that script that I can’t solve.

I use a batch file, and then make gm_cmd execute it on InitPostEntity to upload the cache, it happens after it has been created, while Initialize happens right before it.