Class: U3d::MacInstallation

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) ⇒ MacInstallation

Returns a new instance of MacInstallation.



52
53
54
# File 'lib/u3d/installer.rb', line 52

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



48
49
50
# File 'lib/u3d/installer.rb', line 48

def path
  @path
end

Instance Method Details

#default_log_fileObject



60
61
62
# File 'lib/u3d/installer.rb', line 60

def default_log_file
  "#{ENV['HOME']}/Library/Logs/Unity/Editor.log"
end

#exe_pathObject



64
65
66
# File 'lib/u3d/installer.rb', line 64

def exe_path
  "#{path}/Contents/MacOS/Unity"
end

#packagesObject



68
69
70
71
72
73
74
75
76
# File 'lib/u3d/installer.rb', line 68

def packages
  if Utils.parse_unity_version(version)[0].to_i <= 4
    # Unity < 5 doesn't have packages
    return []
  end
  fpath = File.expand_path('../PlaybackEngines', path)
  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

#versionObject



56
57
58
# File 'lib/u3d/installer.rb', line 56

def version
  plist['CFBundleVersion']
end