FastDL Resource File

i was trying to figure this out, i searched on google for a answer, i found this code [lua]local ClientResources = 0;
local function ProcessFolder(Location)
for k, v in pairs(file.find(Location … ‘*’)) do
if file.IsDir(Location … v) then
ProcessFolder(Location … v … ‘/’)
else
local OurLocation = string.gsub(Location … v,’…/addons/wire/’,")
if !string.find(Location, ‘.db’) then
ClientResources = ClientResources +1;
resource.AddFile(OurLocation);
end
end
end
end

if !SinglePlayer() then
ProcessFolder(’…/addons/wire/models/’);
ProcessFolder(’…/addons/wire/materials/’);
ProcessFolder(’…/addons/wire/sound/’);
end[/lua]
Could i do something like
[lua]local ClientResources = 0;
local function ProcessFolder(Location)
for k, v in pairs(file.find(Location … ‘*’)) do
if file.IsDir(Location … v) then
ProcessFolder(Location … v … ‘/’)
else
local OurLocation = string.gsub(Location … v,’…/addons/’,")
if !string.find(Location, ‘.db’) then
ClientResources = ClientResources +1;
resource.AddFile(OurLocation);
end
end
end
end

if !SinglePlayer() then
ProcessFolder(’…/addons/addon1/models/’);
ProcessFolder(’…/addons/addon1/materials/’);
ProcessFolder(’…/addons/addon1/sound/’);
ProcessFolder(’…/addons/addon2/models/’);
ProcessFolder(’…/addons/addon2/materials/’);
ProcessFolder(’…/addons/addon2/sound/’);
end[/lua]
and have it still download the files?

I don’t know but i think this:
**[Resource.AddFile

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Resource.AddFile)**
will work

Not exactly what i was asking, as you can see, resource.addfile is in there


resource.AddFile(OurLocation);

i was asking if i could change the code to that and if it would still work

Yes, that should work.

The code doesnt appear to work, doesnt anybody else have a example that would do the same function as that one?

You’re not supposed to add the “addons” folder in Resource.AddFile, are you?

[editline]09:32PM[/editline]

just “models/*”

That is correct.

http://www.facepunch.com/showthread.php?t=842886

Make your list ahead of time.

Not exactly what i wanted, but pretty much perfect, Lol

Thanks