mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Reimplemented comparing edit times of PBS/data files to decide whether to compile
This commit is contained in:
@@ -797,6 +797,28 @@ module Compiler
|
||||
write_all
|
||||
mustCompile = true
|
||||
end
|
||||
# Check data files and PBS files, and recompile if any PBS file was edited
|
||||
# more recently than the data files were last created
|
||||
dataFiles.each do |filename|
|
||||
next if !safeExists?("Data/" + filename)
|
||||
begin
|
||||
File.open("Data/#{filename}") { |file|
|
||||
latestDataTime = [latestDataTime, file.mtime.to_i].max
|
||||
}
|
||||
rescue SystemCallError
|
||||
mustCompile = true
|
||||
end
|
||||
end
|
||||
textFiles.each do |filename|
|
||||
next if !safeExists?("PBS/" + filename)
|
||||
begin
|
||||
File.open("PBS/#{filename}") { |file|
|
||||
latestTextTime = [latestTextTime, file.mtime.to_i].max
|
||||
}
|
||||
rescue SystemCallError
|
||||
end
|
||||
end
|
||||
mustCompile |= (latestTextTime >= latestDataTime)
|
||||
# Should recompile if holding Ctrl
|
||||
Input.update
|
||||
mustCompile = true if Input.press?(Input::CTRL)
|
||||
@@ -804,7 +826,7 @@ module Compiler
|
||||
if mustCompile
|
||||
for i in 0...dataFiles.length
|
||||
begin
|
||||
File.delete("Data/#{dataFiles[i]}") if File.exists?("Data/#{dataFiles[i]}")
|
||||
File.delete("Data/#{dataFiles[i]}") if safeExists?("Data/#{dataFiles[i]}")
|
||||
rescue SystemCallError
|
||||
end
|
||||
end
|
||||
|
||||
@@ -774,7 +774,7 @@ module Compiler
|
||||
#=============================================================================
|
||||
def compile_shadow_movesets
|
||||
sections = {}
|
||||
if File.exists?("PBS/shadowmoves.txt")
|
||||
if safeExists?("PBS/shadowmoves.txt")
|
||||
pbCompilerEachCommentedLine("PBS/shadowmoves.txt") { |line, _line_no|
|
||||
if line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||
key = $1
|
||||
|
||||
Reference in New Issue
Block a user