Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/u3d/installation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
module U3d
UNITY_DIR_CHECK = /Unity_\d+\.\d+\.\d+[a-z]\d+/
UNITY_DIR_CHECK_LINUX = /unity-editor-\d+\.\d+\.\d+[a-z]\d+\z/
# Linux unity_builtin_extra seek position for version
UNITY_VERSION_LINUX_POS_LE_2019 = 20
UNITY_VERSION_LINUX_POS_GT_2019 = 48
U3D_DO_NOT_MOVE = ".u3d_do_not_move".freeze

class Installation
Expand Down Expand Up @@ -142,7 +145,15 @@ def self.module_name(config_path)
class InstallationUtils
def self.read_version_from_unity_builtin_extra(file)
File.open(file, "rb") do |f|
f.seek(20)
# 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"
Expand Down