diff --git a/install-discord-linux.rb b/install-discord-linux.rb index f2027ad..af68349 100755 --- a/install-discord-linux.rb +++ b/install-discord-linux.rb @@ -32,7 +32,7 @@ class Dir end ## For backwards compat - def chdir(dir = nil &block) + def chdir(dir = nil, &block) if dir.nil? Dir.chdir(self, &block) else @@ -61,8 +61,8 @@ File.mkdir($CONFIG[:icon_dir]) if not File.exist?($CONFIG[:icon_dir]) $CONFIG[:discord_config_path] = Dir.new(Dir.home) / '.config' / 'discord' $CONFIG[:local_application_install_dir] = Dir.new(Dir.home) / '.local' / 'share' / 'applications' File.mkdir($CONFIG[:local_application_install_dir]) if not File.exist?($CONFIG[:local_application_install_dir]) -$CONFIG[:desktop_path] = Dir.new(Dir.home) / '.local' / 'share' / 'applications' / 'discord.desktop' $CONFIG[:install_dir] = Dir.new(Dir.home) / '.opt' +$CONFIG[:desktop_path] = $CONFIG[:install_dir] / 'Discord' / 'discord.desktop' File.mkdir($CONFIG[:install_dir]) if not File.exist?($CONFIG[:install_dir]) $CONFIG[:discord_path] = $CONFIG[:install_dir] / 'Discord' $CONFIG[:desktop_file_path] = $CONFIG[:discord_path] / 'discord.desktop' @@ -76,11 +76,11 @@ Name=Discord StartupWMClass=discord Comment=All-in-one voice and text chat for gamers that's free, secure, and works on both your desktop and phone. GenericName=Internet Messenger -Exec=#{$CONFIG[:install_dir].path}/Discord/Discord +Exec=#{$CONFIG[:discord_dir]}/Discord Icon=discord Type=Application Categories=Network;InstantMessaging; -Path=#{$CONFIG[:install_dir].path}/Discord +Path=#{$CONFIG[:discord_path]} EOF # END: Variables @@ -104,6 +104,7 @@ OptionParser.new do |parser| parser.on('-u', '--uninstall', "Uninstall Discord (not-implemented)") do $CONFIG[:action] = 'uninstall' + $CONFIG[:backup_filename] = Dir.home / 'discord-backup-' + Time.now.strftime('%Y-%m-%d') + '.tar.gz' end parser.on('-b', '--backup [FILENAME]', "Backup Discord Installation") do |backup_filename| @@ -127,7 +128,7 @@ OptionParser.new do |parser| $CONFIG[:debug] = true end - parser.on('--keep', 'Keep discord tar.gz file (default: False)') do + parser.on('--keep', "Keep discord tar.gz file (default: #{$CONFIG[:keep_installer].to_s})") do $CONFIG[:keep_installer] = true end @@ -200,9 +201,12 @@ class Installer File.unlink(installer_file) end end + + update_desktop_file end end + # END: Helper Classes