Reading Contents From Workshop File

Hi,

I’m trying to figure out a way to read the contents of a particular GMod Workshop file. I have realized that using file.Find with the second parameter “workshop” only shows the dump of all the Workshop file contents. I basically want to somehow find a one-to-one correspondence between file and ID or read the contents from a Workshop file. I know I can use GMAD to extract the files and read them but I need a lightweight solution (i.e. automated either online or on the server via GLua).

I have a few ideas , but before I go ahead and assume things. What exactly are you trying to do?

I’m making a system that can automatically add a Workshop addon to the server and then have the server make content (via PHP and GLua). Ideally, I want to read the files from that Workshop file so I can use the paths/file names to generate custom content for particular users.

The C++ code explains the file format: https://github.com/garrynewman/gmad/blob/master/include/AddonReader.h#L35-L116

It is possible to read files directly from a specific addon in GLua by using it’s name as the path for file functions, but this has always struck me as kind of jank. If you’re looking for something external of Gmod, probably best to either run gmad via the shell or parse the file yourself using that code as a guide.

I still don’t fully understand what you’re going for, though.

I’m fine with anything internal. But the question is can you read the files directly from a specific Workshop addon installed on the server?

You know, you could just refer the players the Workshop file. Get them to add resource.AddWorkshop(“https://steamcommunity.com/sharedfiles/filedetails/?id=127986968”)
then get them to download Fox Warriors resource generator:
http://forum.facepunch.com/showthread.php?t=904405