Garry's Mod Forced Download Directories

So I’ve been trying to get forced download directories to work by using the AddDir() function, but it won’t work.

I’m almost certain that this is because of the new Gmod 13 update and that the findDir() function is now file.find().

So I found this thread that recommends using this code here:


function AddDir(dir)
 
local files, dirs = file.Find(dir.."/*", "GAME")
 
for _, fdir in pairs(dirs) do
    if fdir != ".svn" then
    AddDir(dir.."/"..fdir)
    end
end
 
for k,v in pairs(files) do
    resource.AddFile(dir.."/"..v)
end
 
end
 
AddDir("materials/donator/models/materials/models/player/merc")
AddDir("models/donator/models/models/player")
AddDir("*WHATEVER*/donator/models/lua")

The problem with this code is that if I do something like:


AddDir("materials/")

It tries to literally add every single materials from every one of my games. It adds 1000s of materials that I can’t even find on my PC. I want the code to only add materials from my “C:\Garry’s Mod Server\garrysmod” directory, nothing else.

Anyone know what the problem could be? Why is it adding materials from other games besides Gmod? If anyone knows the answer, or a more simple solution, please let me know. Don’t make me have to type in 1000 resource.addfile().

Summary of my problem: I tried to use the above to get users to download custom materials. Instead, the above downloads every single material I have, and even ones that I don’t have in my server folder. Maybe it’s finding the materials in the .paks? Who knows.

Please help. D: