Class: U3d::InstallationUtils

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

Class Method Summary collapse

Class Method Details

.read_version_from_unity_builtin_extra(file) ⇒ Object



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/u3d/installation.rb', line 149

def self.read_version_from_unity_builtin_extra(file)
  File.open(file, "rb") do |f|
    # Check if it is version lower or equal to 2019
    seek_pos = UNITY_VERSION_LINUX_POS_LE_2019
    f.seek(seek_pos)
    z = f.read(1)
    if z == "\x00"
      # Version is greater than 2019
      seek_pos = UNITY_VERSION_LINUX_POS_GT_2019
    end
    f.seek(seek_pos)
    s = ""
    while (c = f.read(1))
      break if c == "\x00"

      s += c
    end
    s
  end
end