Class: U3d::UnityProject
- Inherits:
-
Object
- Object
- U3d::UnityProject
- Defined in:
- lib/u3d/unity_project.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #assets_path ⇒ Object
- #editor_version ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(path) ⇒ UnityProject
constructor
A new instance of UnityProject.
- #project_settings_path ⇒ Object
Constructor Details
#initialize(path) ⇒ UnityProject
Returns a new instance of UnityProject.
29 30 31 |
# File 'lib/u3d/unity_project.rb', line 29 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
27 28 29 |
# File 'lib/u3d/unity_project.rb', line 27 def path @path end |
Instance Method Details
#assets_path ⇒ Object
37 38 39 |
# File 'lib/u3d/unity_project.rb', line 37 def assets_path File.join(@path, 'Assets') end |
#editor_version ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/u3d/unity_project.rb', line 45 def editor_version require 'yaml' project_version = File.join(project_settings_path, 'ProjectVersion.txt') return nil unless File.exist? project_version yaml = YAML.safe_load(File.read(project_version)) version = yaml['m_EditorVersion'] version.gsub!(/(\d+\.\d+\.\d+)(?:x)?(\w\d+)(?:Linux)?/, '\1\2') if Helper.linux? version end |
#exist? ⇒ Boolean
33 34 35 |
# File 'lib/u3d/unity_project.rb', line 33 def exist? Dir.exist?(assets_path) && Dir.exist?(project_settings_path) end |
#project_settings_path ⇒ Object
41 42 43 |
# File 'lib/u3d/unity_project.rb', line 41 def project_settings_path File.join(@path, 'ProjectSettings') end |