mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-22 19:13:14 +00:00
add script for generating removal instructions for NSI
This commit is contained in:
parent
53c954056e
commit
51b57c8659
10
tools/windows/conf.rb
Executable file
10
tools/windows/conf.rb
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
def read_config
|
||||
IO.readlines("#{File.dirname(__FILE__)}/conf.sh").
|
||||
map { |line| line.chomp.gsub(%r{\$HOME|\$\{HOME\}}, ENV['HOME']) }.
|
||||
reject { |line| %r{^#|^\s*$}.match line }.
|
||||
select { |line| %r{=}.match line }.
|
||||
map { |line| line.split %r{=} }.
|
||||
to_h
|
||||
end
|
@ -1,2 +1,3 @@
|
||||
mxe_dir=${HOME}/prog/video/mingw/cross
|
||||
saxon_dir=${HOME}/opt/saxon-he
|
||||
file_list_dir=${HOME}/prog/video/mingw/src/uc/file-lists
|
||||
|
32
tools/windows/file_list_to_nsi_uninstaller_instructions.rb
Executable file
32
tools/windows/file_list_to_nsi_uninstaller_instructions.rb
Executable file
@ -0,0 +1,32 @@
|
||||
#!/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.exists?(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}") }
|
Loading…
Reference in New Issue
Block a user