Class: U3d::LinuxInstallation

Inherits:
Installation show all
Defined in:
lib/u3d/installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Installation

create

Constructor Details

#initialize(path: nil) ⇒ LinuxInstallation

Returns a new instance of LinuxInstallation.



88
89
90
# File 'lib/u3d/installer.rb', line 88

def initialize(path: nil)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



86
87
88
# File 'lib/u3d/installer.rb', line 86

def path
  @path
end

Instance Method Details

#default_log_fileObject



105
106
107
# File 'lib/u3d/installer.rb', line 105

def default_log_file
  "#{ENV['HOME']}/.config/unity3d/Editor.log"
end

#exe_pathObject



109
110
111
# File 'lib/u3d/installer.rb', line 109

def exe_path
  "#{path}/Unity"
end

#packagesObject



113
114
115
# File 'lib/u3d/installer.rb', line 113

def packages
  false
end

#versionObject



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/u3d/installer.rb', line 92

def version
  # I don't find an easy way to extract the version on Linux
  require 'rexml/document'
  fpath = "#{path}/Data/PlaybackEngines/LinuxStandaloneSupport/ivy.xml"
  raise "Couldn't find file #{fpath}" unless File.exist? fpath
  doc = REXML::Document.new(File.read(fpath))
  version = REXML::XPath.first(doc, 'ivy-module/info/@e:unityVersion').value
  if m = version.match(/^(.*)x(.*)Linux$/)
    version = "#{m[1]}#{m[2]}"
  end
  version
end