Replace PC username with "..." in errors and replaced / with \.

This commit is contained in:
m3rein
2020-09-05 21:01:18 +02:00
parent dffb5de19d
commit 3955786370

View File

@@ -61,10 +61,11 @@ def pbPrintException(e)
errorlog = RTP.getSaveFileName("errorlog.txt") errorlog = RTP.getSaveFileName("errorlog.txt")
end end
File.open(errorlog,"ab") { |f| f.write(premessage); f.write(message) } File.open(errorlog,"ab") { |f| f.write(premessage); f.write(message) }
errorlogline = errorlog.sub(Dir.pwd+"\\","") errorlogline = errorlog.sub(Dir.pwd + "\\", "")
errorlogline = errorlogline.sub(Dir.pwd+"/","") errorlogline.sub!(Dir.pwd + "/", "")
errorlogline = errorlogline.gsub("/","\\") errorlogline.sub!(pbGetUserName, "...")
errorlogline = "\r\n"+errorlogline if errorlogline.length>20 errorlogline = "\r\n" + errorlogline if errorlogline.length > 20
errorlogline.gsub!("/", "\\")
print("#{message}\r\nThis exception was logged in #{errorlogline}.\r\nPress Ctrl+C to copy this message to the clipboard.") print("#{message}\r\nThis exception was logged in #{errorlogline}.\r\nPress Ctrl+C to copy this message to the clipboard.")
end end
@@ -98,7 +99,7 @@ module FileLineData
@linedata = "" @linedata = ""
@lineno = 0 @lineno = 0
@section = nil @section = nil
@key = nil @key = nil
@value = nil @value = nil
def self.file; return @file; end def self.file; return @file; end
@@ -347,7 +348,7 @@ def csvfield!(str)
end end
end end
str[0,fieldbytes] = "" str[0,fieldbytes] = ""
if !str[/^\s*,/] && !str[/^\s*$/] if !str[/^\s*,/] && !str[/^\s*$/]
raise _INTL("Invalid quoted field (in: {1})\r\n{2}",str,FileLineData.linereport) raise _INTL("Invalid quoted field (in: {1})\r\n{2}",str,FileLineData.linereport)
end end
str[0,str.length] = $~.post_match str[0,str.length] = $~.post_match
@@ -528,7 +529,7 @@ def pbGetCsvRecord(rec,lineno,schema)
record.push(field.to_i) record.push(field.to_i)
end end
when "x" # Hexadecimal number when "x" # Hexadecimal number
field = csvfield!(rec) field = csvfield!(rec)
if !field[/^[A-Fa-f0-9]+$/] if !field[/^[A-Fa-f0-9]+$/]
raise _INTL("Field '{1}' is not a hexadecimal number\r\n{2}",field,FileLineData.linereport) raise _INTL("Field '{1}' is not a hexadecimal number\r\n{2}",field,FileLineData.linereport)
end end
@@ -621,7 +622,7 @@ def pbWriteCsvRecord(record,file,schema)
rec = (record.is_a?(Array)) ? record.clone : [record] rec = (record.is_a?(Array)) ? record.clone : [record]
for i in 0...schema[1].length for i in 0...schema[1].length
chr = schema[1][i,1] chr = schema[1][i,1]
file.write(",") if i>0 file.write(",") if i>0
if rec[i].nil? if rec[i].nil?
# do nothing # do nothing
elsif rec[i].is_a?(String) elsif rec[i].is_a?(String)
@@ -866,7 +867,7 @@ end
# Scripted constants # Scripted constants
#=============================================================================== #===============================================================================
def pbFindScript(a,name) def pbFindScript(a,name)
a.each { |i| a.each { |i|
next if !i next if !i
return i if i[1]==name return i if i[1]==name
} }
@@ -1121,7 +1122,7 @@ def pbCompileAllData(mustCompile)
# No dependencies # No dependencies
yield(_INTL("Compiling map connection data")) yield(_INTL("Compiling map connection data"))
pbCompileConnections pbCompileConnections
# No dependencies # No dependencies
yield(_INTL("Compiling ability data")) yield(_INTL("Compiling ability data"))
pbCompileAbilities pbCompileAbilities
# Depends on PBTypes # Depends on PBTypes
@@ -1142,7 +1143,7 @@ def pbCompileAllData(mustCompile)
# Depends on PBSpecies, PBMoves # Depends on PBSpecies, PBMoves
yield(_INTL("Compiling machine data")) yield(_INTL("Compiling machine data"))
pbCompileMachines pbCompileMachines
# No dependencies # No dependencies
yield(_INTL("Compiling Trainer type data")) yield(_INTL("Compiling Trainer type data"))
pbCompileTrainerTypes pbCompileTrainerTypes
# Depends on PBSpecies, PBItems, PBMoves # Depends on PBSpecies, PBItems, PBMoves
@@ -1286,4 +1287,4 @@ def pbCompiler
Graphics.update Graphics.update
end end
end end
end end