Here's an interesting scenario...
I just recently added the ability to log chats to a file in my channel capture plugin, and I noticed something weird that happened today. If a chat comes through, and the plugin subsequently tries to log the chat to a file, while I have the Add Plugin dialog open, the file open operation fails if you use GetInfo(58) (the logs directory path) if it is defined as a relative path.
Here's the error:
I seem to have fixed it by replacing GetInfo(58) with
GetInfo(58):gsub("^\.\",GetInfo(56)) to construct an absolute path.
I just recently added the ability to log chats to a file in my channel capture plugin, and I noticed something weird that happened today. If a chat comes through, and the plugin subsequently tries to log the chat to a file, while I have the Add Plugin dialog open, the file open operation fails if you use GetInfo(58) (the logs directory path) if it is defined as a relative path.
Here's the error:
Run-time error
Plugin: Aardwolf_Chat_Capture_Miniwindow (called from world: Aardwolf)
Function/Sub: OnPluginBroadcast called by Plugin Aardwolf_Chat_Capture_Miniwindow
Reason: Executing plugin Aardwolf_Chat_Capture_Miniwindow sub OnPluginBroadcast
[string "Plugin"]:490: .\logs\AardwolfChatLog.txt: No such file or directory
stack traceback:
[C]: in function 'assert'
[string "Plugin"]:490: in function 'stampAndStore'
[string "Plugin"]:556: in function <[string "Plugin"]:546>
Error context in script:
486 : if (log_to_file == 1) then
487 : if (log_colour_codes == 0) then
488 : log_text = strip_colours(log_text)
489 : end
490*: local f = assert(io.open (GetInfo(58)..GetInfo(2).."ChatLog.txt", "a+")) -- handle to chat log file
491 : f:write (log_text.."\n") -- write to it
492 : f:close () -- close that file now
493 : end
494 : I seem to have fixed it by replacing GetInfo(58) with
GetInfo(58):gsub("^\.\",GetInfo(56)) to construct an absolute path.