lib/u3d/unity_project.rb in u3d-1.1.3 vs lib/u3d/unity_project.rb in u3d-1.1.4
- old
+ new
@@ -29,15 +29,23 @@
def initialize(path)
@path = path
end
def exist?
- Dir.exist?("#{@path}/Assets") && Dir.exist?("#{@path}/ProjectSettings")
+ Dir.exist?(assets_path) && Dir.exist?(project_settings_path)
end
+ def assets_path
+ File.join(@path, 'Assets')
+ end
+
+ def project_settings_path
+ File.join(@path, 'ProjectSettings')
+ end
+
def editor_version
require 'yaml'
- project_version = "#{@path}/ProjectSettings/ProjectVersion.txt"
+ 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