mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-10-22 07:21:21 +00:00
ab6455f68c
Several deprecated functions were removed: `Dir.exists?`, `File.exists?` & `FileTest.exists?`. Instead of those `FileTest.exist?` must be used (without the `s`). See the release notes for Ruby 3.2.0 as well as the issue for removing the functions: https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/ https://bugs.ruby-lang.org/issues/17391
33 lines
708 B
Ruby
Executable File
33 lines
708 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
require "pp"
|
|
require_relative "conf"
|
|
|
|
fail "Missing file list name" if ARGV.empty?
|
|
|
|
config = read_config
|
|
file_name = ARGV[0]
|
|
file_name = "#{config['file_list_dir']}/#{file_name}.txt" if !FileTest.exist?(file_name)
|
|
files = IO.readlines(file_name).map { |file| file.chomp.gsub(%r{^\.}, '').gsub(%r{^/}, '').gsub(%r{/}, '\\') }
|
|
dirs = {}
|
|
|
|
files.each do |file|
|
|
puts %Q( Delete "$INSTDIR\\#{file}")
|
|
|
|
dir = file
|
|
while true
|
|
break unless %r{\\}.match(file)
|
|
|
|
dir.gsub!(%r{\\[^\\]+$}, '')
|
|
dirs[dir] = true
|
|
end
|
|
end
|
|
|
|
puts
|
|
|
|
dirs.
|
|
keys.
|
|
sort_by { |dir| [ dir.gsub(%r{[^\\]+}, '').length, dir ] }.
|
|
reverse.
|
|
each { |dir| puts %Q( RMDir "$INSTDIR\\#{dir}") }
|