bin/rvpacker-txt in rvpacker-txt-1.6.0 vs bin/rvpacker-txt in rvpacker-txt-1.7.0

- old
+ new

@@ -43,11 +43,12 @@ cmd.on('-f', '--force', 'Force rewrite all files. Cannot be used with --append', 'USE WITH CAUTION!') do options[:force] = true end - cmd.on('-a', '--append', 'When you update the rvpacker-txt, you probably should re-read', 'your files with append, as some new text might be added to parser', 'Cannot be used with --force') do + cmd.on('-a', '--append', 'When you update the rvpacker-txt, you probably should re-read', + 'your files with append, as some new text might be added to parser', 'Cannot be used with --force') do raise '--append cannot be used beside --force.' if options[:force] options[:append] = true end cmd.on('-h', '--help', 'Show help message') do @@ -81,35 +82,35 @@ logging = options[:logging] disable_processing = options[:disable_processing] force = options[:force] append = options[:append] -extensions = { xp: '.rxdata', vx: 'rvdata', ace: 'rvdata2' } +extensions = { xp: 'rxdata', vx: 'rvdata', ace: 'rvdata2' } original_directory = Dir.glob(File.join(input_dir, '{data,original}'), File::FNM_CASEFOLD).first raise '"Data" or "original" directory not found within input directory.' unless original_directory maps_path = File.join(input_dir, 'translation', 'maps') other_path = File.join(input_dir, 'translation', 'other') FileUtils.mkdir_p(maps_path) FileUtils.mkdir_p(other_path) -engine = extensions.find do |_symbol, extension| - File.exist?(File.join(original_directory, "System.#{extension}")) +engine = extensions.each do |symbol, extension| + break symbol if File.exist?(File.join(original_directory, "System.#{extension}")) end || (raise "Couldn't determine project engine.") -files = Dir.glob("#{original_directory}/*#{extensions[engine[0]]}") +files = Dir.glob("#{original_directory}/*#{extensions[engine]}") maps_files_paths = [] other_files_paths = [] system_file_path = nil scripts_file_path = nil files.each do |file| basename = File.basename(file) - next unless basename.end_with?(extensions[engine[0]]) + next unless basename.end_with?(extensions[engine]) if basename.start_with?(/Map[0-9]/) maps_files_paths.push(file) elsif !basename.start_with?(/Map|Tilesets|Animations|System|Scripts|Areas/) other_files_paths.push(file) @@ -130,12 +131,12 @@ puts "WARNING! You're about to forcefully rewrite all your translation files, including _trans files.\nIf you really want to do it, make sure you've made a backup of your _trans files, if you made some changes in them already.\nInput 'Y' to continue." exit unless gets.chomp == 'Y' wait_time = Time.now - wait_time_start - 'force' + :force else - append ? 'append' : 'default' + append ? :append : :default end puts 'Custom processing for this game is enabled. Use --disable-custom-processing to disable it.' unless game_type.nil? if options[:action] == 'read'