[BUG?] Workshop-based add-ons can't open files for reading
3 replies, posted
I've had issues with uploading an add-on to the Workshop. I've made a previous post about this, but I don't think I made things clear. This might be my own misunderstanding of Workshop add-ons; if that's the case, I'd like some clarification.
The add-on appears to work perfectly fine if I put it directly into the garrysmodbeta folder. However, it doesn't if I upload then download it from the Workshop. It errors out related to the following code:
[code]
local list = file.Find("mprime_themes/*.lua",LUA_PATH)
for _,fil in pairs(list) do
print(fil,"mprime_themes/"..fil);
local f=file.Open("mprime_themes/"..fil,'rb',LUA_PATH)
if f ~= nil then
RunString('function THEME_FUNCTION()\nreturn {\n'..f:ReadString(f:Size())..'\n};\nend')
--RunString('function a()\nreturn {\n'..file.Read("autorun/client/mprime_themes/"..fil,LUA_PATH)..'\n};\nend')
themes[string.sub(fil,0,string.find(fil,".lua")-1)]=THEME_FUNCTION();
Msg('MPHUD: mounted \''..string.sub(fil,0,string.find(fil,".lua")-1)..'\' successfully\n')
f:Close()
end
end[/code]
The folders exist and the filenames are read perfectly fine, but the "if f ~= nil" line doesn't appear to ever be true when using this from Workshop. I'm not completely sure why, but the reasons could be a lack of file access permissions.
It has kind of been a month, and no response - this needs to be read. Bump.
well if you are doing a text file then do it in the data folder. That works for me.
[QUOTE=jfmherokiller;36486310]well if you are doing a text file then do it in the data folder. That works for me.[/QUOTE]
They're .lua files.
Sorry, you need to Log In to post a reply to this thread.