Class: U3d::WindowsInstallation

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

Constant Summary

Constants inherited from Installation

Installation::NOT_PLAYBACKENGINE_PACKAGES, Installation::PACKAGE_ALIASES

Instance Attribute Summary

Attributes inherited from Installation

#root_path

Instance Method Summary collapse

Methods inherited from Installation

create, #do_not_move!, #do_not_move?, #initialize, #package_installed?

Constructor Details

This class inherits a constructor from U3d::Installation

Instance Method Details

#build_numberObject



356
357
358
# File 'lib/u3d/installation.rb', line 356

def build_number
  @build_number ||= WindowsInstallationHelper.new.build_number(exe_path)
end

#clean_install?Boolean

Returns:

  • (Boolean)


408
409
410
# File 'lib/u3d/installation.rb', line 408

def clean_install?
  do_not_move? || !(root_path =~ UNITY_DIR_CHECK).nil?
end

#default_log_fileObject



360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/u3d/installation.rb', line 360

def default_log_file
  if @logfile.nil?
    begin
      loc_appdata = Utils.windows_local_appdata
      log_dir = File.expand_path('Unity/Editor/', loc_appdata)
      UI.important "Log directory (#{log_dir}) does not exist" unless Dir.exist? log_dir
      @logfile = File.expand_path('Editor.log', log_dir)
    rescue RuntimeError => ex
      UI.error "Unable to retrieve the editor logfile: #{ex}"
    end
  end
  @logfile
end

#exe_pathObject



374
375
376
# File 'lib/u3d/installation.rb', line 374

def exe_path
  File.join(@root_path, 'Editor', 'Unity.exe')
end

#module_name_pattern(module_name) ⇒ Object



395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/u3d/installation.rb', line 395

def module_name_pattern(module_name)
  case module_name
  when 'Documentation'
    return "#{root_path}/Editor/Data/Documentation/"
  when 'StandardAssets'
    return "#{root_path}/Editor/Standard Assets/"
  when 'MonoDevelop'
    return "#{root_path}/MonoDevelop/"
  else
    UI.crash! "No pattern is known for #{module_name} on Windows"
  end
end

#packagesObject



383
384
385
386
387
388
389
390
391
392
393
# File 'lib/u3d/installation.rb', line 383

def packages
  path = "#{root_path}/Editor/Data/"
  pack = []
  PlaybackEngineUtils.list_module_configs(path).each do |mpath|
    pack << PlaybackEngineUtils.module_name(mpath)
  end
  NOT_PLAYBACKENGINE_PACKAGES.each do |module_name|
    pack << module_name unless Dir[module_name_pattern(module_name)].empty?
  end
  pack
end

#pathObject



378
379
380
381
# File 'lib/u3d/installation.rb', line 378

def path
  UI.deprecated("path is deprecated. Use root_path instead")
  @root_path || @path
end

#versionObject



349
350
351
352
353
354
# File 'lib/u3d/installation.rb', line 349

def version
  path = "#{root_path}/Editor/Data/"
  package = PlaybackEngineUtils.list_module_configs(path).first
  raise "Couldn't find a module under #{path}" unless package
  PlaybackEngineUtils.unity_version(package)
end