Skip to content

Commit

Permalink
Merge pull request #410 from DiegoTorresSED/master
Browse files Browse the repository at this point in the history
Fixing error when installing Unity 2020 version in Linux
  • Loading branch information
lacostej authored Apr 13, 2022
2 parents c4eaeb4 + 021ebd1 commit 4801911
Showing 1 changed file with 12 additions and 1 deletion.
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

0 comments on commit 4801911

Please sign in to comment.