11-- Garry has imposed a file extension whitelist for the Steam Workshop which does not permit the dangerous format .txt
22-- Therefore, we must store our .txt's in default_data_files.lua, and then extract them when first run
33
4+ local ignored_dirs = {
5+ [" expression2/tests" ] = true ,
6+ }
7+
48-- Compress all files in addons/wire/data recursively into 1 json string
59local function ReadDir (root )
10+ if ignored_dirs [root ] then return nil end
611 local tab = {}
712 local files ,dirs = file .Find (" addons/wire/data/" .. root .. " *" ," GAME" )
813 for _ , f in pairs (files ) do
@@ -16,7 +21,7 @@ local function ReadDir(root)
1621 return tab
1722end
1823-- Uncomment and Rename this file to wire/lua/wire/default_data_files.lua to update it
19- // file .Write (" default_data_files.txt" , " //" .. util .TableToJSON (ReadDir (" " )))
24+ -- file.Write("default_data_files.txt", "//"..util.TableToJSON(ReadDir("")))
2025
2126-- Decompress the json string wire/lua/wire/default_data_files.lua into the corresponding 36+ default data files
2227local function WriteDir (tab )
@@ -34,7 +39,7 @@ if not file.Exists("expression2/_helloworld_.txt", "DATA") then
3439 local compressed = file .Read (" wire/default_data_files.lua" ," LUA" )
3540 -- The client cannot read lua files sent by the server (for security?), so clientside this'll only work
3641 -- if the client actually has Wiremod installed, though with workshop autodownload that'll be common
37- if compressed ! = nil then
42+ if compressed ~ = nil then
3843 WriteDir (util .JSONToTable (string.sub (compressed , 3 )))
3944 end
4045end
0 commit comments