Skip to content
Snippets Groups Projects
Commit 6b076a73 authored by cleemy desu wayo's avatar cleemy desu wayo
Browse files

Fix bug: fix the error when VRChat log file does not exist

If Outvoke was started with no VRChat log file present and then
VRChat was started with Outvoke still running, Outvoke could
terminate with an error.

This has been fixed.

how to repro:

---------------
1. While VRChat is not running, delete all VRChat log files

2. launch Outvoke as follows:

$ ./outvoke.rb -e 'hook "vrchat-001", /pickup/i'

3. start VRChat
---------------
parent c3217d48
Branches main
No related tags found
No related merge requests found
#!/usr/bin/env ruby
#
# ==========================================================================
# Outvoke -- version 0.0.99.20241112
# Outvoke -- version 0.0.99.20241112.1
#
# written by cleemy desu wayo / Licensed under CC0 1.0
#
......@@ -25,7 +25,7 @@ class Outvoke
@version = Struct.new(:branch, :body).new(
'0.1',
'0.0.99.20241112'
'0.0.99.20241112.1'
)
@ds = Hash.new
......@@ -562,6 +562,7 @@ class OutvokeDataSourceVrchat < OutvokeDataSource
@status.file_size = 0
@status.count = 0
@status.lineno = 0
@status.last_joined_time = Time.now
@log_dir = ''
@is_first_time_log_check = true
@has_new_log_lines = false
......@@ -605,12 +606,14 @@ class OutvokeDataSourceVrchat < OutvokeDataSource
end
def before_each_event
tmp_now = Time.now
Dir.glob("#{@log_dir}/output_log_*.txt").last.then do
if _1 != @status.logfile
@status.logfile = _1
@status.lineno = 0
if not $outvoke.quiet_mode? # TODO
puts "[#{Time.now}] [outvoke-system] #{@label}: a new log file was found." if @status.logfile
puts "[#{tmp_now}] [outvoke-system] #{@label}: a new log file was found." if @status.logfile
end
end
end
......@@ -618,7 +621,7 @@ class OutvokeDataSourceVrchat < OutvokeDataSource
# return if not found
unless @status.logfile
if @is_first_time_log_check
puts "[#{Time.now}] [outvoke-system] #{@label}: ERROR: VRChat log file not found"
puts "[#{tmp_now}] [outvoke-system] #{@label}: ERROR: VRChat log file not found"
end
return
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment