lib/u3d/installer.rb in u3d-1.0.10 vs lib/u3d/installer.rb in u3d-1.0.11
- old
+ new
@@ -104,14 +104,11 @@
CommonInstaller.sanitize_install(source_path, new_path, command, dry_run: dry_run)
end
def installed
paths = (list_installed_paths + spotlight_installed_paths).uniq
- versions = paths.map { |path| MacInstallation.new(root_path: path) }
-
- # sorting should take into account stable/patch etc
- versions.sort! { |x, y| x.version <=> y.version }
+ paths.map { |path| MacInstallation.new(root_path: path) }
end
# rubocop:disable UnusedMethodArgument
def install(file_path, version, installation_path: nil, info: {})
# rubocop:enable UnusedMethodArgument
@@ -204,15 +201,12 @@
CommonInstaller.sanitize_install(source_path, new_path, command, dry_run: dry_run)
end
def installed
- find = File.join(DEFAULT_LINUX_INSTALL, 'unity-editor-*')
- versions = Dir[find].map { |path| LinuxInstallation.new(root_path: path) }
-
- # sorting should take into account stable/patch etc
- versions.sort! { |x, y| x.version <=> y.version }
+ paths = (list_installed_paths + debian_installed_paths).uniq
+ paths.map { |path| LinuxInstallation.new(root_path: path) }
end
# rubocop:disable UnusedMethodArgument
def install(file_path, version, installation_path: nil, info: {})
# rubocop:enable UnusedMethodArgument
@@ -259,10 +253,28 @@
rescue => e
UI.error "Failed to uninstall unity at #{unity.path}: #{e}"
else
UI.success "Successfully uninstalled '#{unity.root_path}'"
end
+
+ private
+
+ def list_installed_paths
+ find = File.join(DEFAULT_LINUX_INSTALL, 'unity-editor-*', 'Editor')
+ paths = Dir[find]
+ paths = paths.map { |u| Pathname.new(u).parent.to_s }
+ UI.verbose "Found list_installed_paths: #{paths}"
+ paths
+ end
+
+ def debian_installed_paths
+ find = File.join(DEFAULT_LINUX_INSTALL, 'Unity', 'Editor')
+ paths = Dir[find]
+ paths = paths.map { |u| Pathname.new(u).parent.to_s }
+ UI.verbose "Found debian_installed_paths: #{paths}"
+ paths
+ end
end
class WindowsInstaller
def sanitize_install(unity, dry_run: false)
source_path = File.expand_path(unity.root_path)
@@ -277,13 +289,10 @@
CommonInstaller.sanitize_install(source_path, new_path, command, dry_run: dry_run)
end
def installed
find = File.join(DEFAULT_WINDOWS_INSTALL, 'Unity*', 'Editor', 'Uninstall.exe')
- versions = Dir[find].map { |path| WindowsInstallation.new(root_path: File.expand_path('../..', path)) }
-
- # sorting should take into account stable/patch etc
- versions.sort! { |x, y| x.version <=> y.version }
+ Dir[find].map { |path| WindowsInstallation.new(root_path: File.expand_path('../..', path)) }
end
def install(file_path, version, installation_path: nil, info: {})
extension = File.extname(file_path)
raise "Installation of #{extension} files is not supported on Windows" if extension != '.exe'