bin/rvpacker-txt in rvpacker-txt-1.3.0 vs bin/rvpacker-txt in rvpacker-txt-1.3.1

- old
+ new

@@ -3,10 +3,11 @@ require 'optparse' $logging = false $shuffle = 0 $no = [false, false, false, false] # 0 is whether to NOT process maps, 1 is other, 2 is system, 3 is scripts +$disable_custom_parsing = false options = {} OptionParser.new do |command| command.banner = "This tool allows to parse RPG Maker project to .txt files and back.\n\nUsage: rvpacker-txt COMMAND [options]\n\nCOMMANDS:\n read - Parses RPG Maker game files to .txt\n write - Writes parsed files back to their initial form\nOPTIONS:\n" @@ -41,21 +42,24 @@ command.on('-s', '--shuffle NUMBER', 'At value 1: Shuffles all lines in strings, at value 2: shuffles all lines and words in strings.') { |number| $shuffle = number } + command.on('--disable-custom-parsing', + 'Disables built-in custom parsing for some games, which may improperly parse/write some games.') + command.on('-l', '--log', 'Log information while processing.') { $logging = true } command.on_tail('-h', '--help', 'Show help message.') { puts command; exit } end.parse!(ARGV) if ARGV.empty? - puts 'COMMAND argument is required.' + puts 'COMMAND argument is required. Use rvpacker-txt -h for help.' exit end options[:action] = ARGV.shift @@ -64,9 +68,10 @@ exit end directory = options[:input_dir] raise "#{directory} not found" unless File.exist?(directory) +directory = File.realpath(directory) original_directory = Dir.foreach(directory).find { |dirname| dirname.downcase == 'original' || dirname.downcase == 'data' } raise '"Data" or "original" directory not found within input directory.' if original_directory.nil? engine = if File.exist?(File.join(directory, original_directory, 'System.rxdata'))