Skip to content

Commit ff8ab0d

Browse files
Don't add E2 tests to Wiremod's default data files
These tests are for developers and so shouldn't be shipped to people who just install the addon through the workshop.
1 parent 2678c4c commit ff8ab0d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lua/wire/default_data_decompressor.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
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
59
local 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
1722
end
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
2227
local 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
4045
end

0 commit comments

Comments
 (0)