Class: U3d::WindowsInstallation
- Inherits:
-
Installation
- Object
- Installation
- U3d::WindowsInstallation
- Defined in:
- lib/u3d/installer.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #default_log_file ⇒ Object
- #exe_path ⇒ Object
-
#initialize(path: nil) ⇒ WindowsInstallation
constructor
A new instance of WindowsInstallation.
- #packages ⇒ Object
- #version ⇒ Object
Methods inherited from Installation
Constructor Details
#initialize(path: nil) ⇒ WindowsInstallation
Returns a new instance of WindowsInstallation.
121 122 123 |
# File 'lib/u3d/installer.rb', line 121 def initialize(path: nil) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
119 120 121 |
# File 'lib/u3d/installer.rb', line 119 def path @path end |
Instance Method Details
#default_log_file ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/u3d/installer.rb', line 135 def default_log_file if @logfile.nil? begin loc_appdata = Utils.windows_local_appdata log_dir = File.('Unity/Editor/', loc_appdata) UI.important "Log directory (#{log_dir}) does not exist" unless Dir.exist? log_dir @logfile = File.('Editor.log', log_dir) rescue RuntimeError => ex UI.error "Unable to retrieve the editor logfile: #{ex}" end end @logfile end |
#exe_path ⇒ Object
149 150 151 |
# File 'lib/u3d/installer.rb', line 149 def exe_path File.join(@path, 'Editor', 'Unity.exe') end |
#packages ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/u3d/installer.rb', line 153 def packages # Unity prior to Unity5 did not have package return [] if Utils.parse_unity_version(version)[0].to_i <= 4 fpath = "#{path}/Editor/Data/PlaybackEngines/" raise "Unity installation does not seem correct. Couldn't locate PlaybackEngines." unless Dir.exist? fpath Dir.entries(fpath).select { |e| File.directory?(File.join(fpath, e)) && !(e == '.' || e == '..') } end |
#version ⇒ Object
125 126 127 128 129 130 131 132 133 |
# File 'lib/u3d/installer.rb', line 125 def version require 'rexml/document' fpath = "#{path}/Editor/Data/PlaybackEngines/windowsstandalonesupport/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 version end |