pindo 5.0.2 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10f0f3745c15acde24feb9bdb931bfcfdbc303258d631426aa57624c07a4c9b7
4
- data.tar.gz: 40614dbbb067470b2a0f5c81712720179f9074efbdcb57bd32855a1944fb9b45
3
+ metadata.gz: fa8cf123e63f04932c88a6a895c05a81d4c8c71fa78c38bb03440b840408b425
4
+ data.tar.gz: 682c25d35dcae3f865c07608df7687c5da5408152b0677bb23fdf443f0027b6d
5
5
  SHA512:
6
- metadata.gz: d7d064e4852ee0fba47ce2af38bc56ad4bb7c879fddd5bbca42ae6ac4d7a4498ac68fc99fd7a11d50204546287350cac75c0d31b0e3975cba2c5446c0d2c5634
7
- data.tar.gz: 7d087143f365ece955ab0c571480de52e8f54948a306f46610ed922ddb91209f296a492889bf670e743eb55444076effcf75d6dc96a00958d0372d8b094aea4f
6
+ metadata.gz: 1ec965bdecaac77916f6057a9ee15abb0981635a676150e4853259015690f61ca1d5f1f194e39cc16e8feeef861c6919e33c5b28559abc20caf5ae6ae6d2cf21
7
+ data.tar.gz: 66853e92ae567a42da0d9e56ac0a0972f45611ad2ac57086e040bf635fe95c49a6bfadbc49d2742c9b73832cea69e8dc79e152f7b0ecd316b3cc54c47e96ce87
@@ -95,10 +95,9 @@ module Pindo
95
95
  end
96
96
 
97
97
  project_unity_version = unity_helper.get_unity_version(pindo_project_dir)
98
- project_unity_major_version = project_unity_version.split('.')[0..1].join('.')
99
98
  puts
100
99
  puts "工程的Unity版本: #{project_unity_version}"
101
- unity_exe_path = unity_helper.find_unity_path(unity_major_version:project_unity_major_version, force_change_version: @force_select_unity)
100
+ unity_exe_path = unity_helper.find_unity_path(project_unity_version:project_unity_version, force_change_version: @force_select_unity)
102
101
  puts "选择的Unity路径: #{unity_exe_path}"
103
102
  puts
104
103
 
@@ -25,8 +25,13 @@ module Pindo
25
25
  end
26
26
  end
27
27
 
28
- def find_unity_path(unity_major_version:nil, force_change_version:false)
28
+ def find_unity_path(project_unity_version:nil, force_change_version:false)
29
29
 
30
+ if project_unity_version.nil? || project_unity_version.empty?
31
+ raise "Project Unity version is nil or empty"
32
+ end
33
+
34
+ unity_major_version = project_unity_version.split('.')[0..1].join('.')
30
35
  paths = case RUBY_PLATFORM
31
36
  when /darwin/
32
37
  UNITY_MAC_PATHS
@@ -68,9 +73,15 @@ module Pindo
68
73
  raise Informative, "未找到任何Unity版本"
69
74
  end
70
75
 
76
+
77
+ select_unity_versions = unity_versions.select { |v| v[:version] == project_unity_version } || []
78
+ if !select_unity_versions.nil? && !select_unity_versions.empty? && select_unity_versions.length >= 1
79
+ return select_unity_versions.first[:path]
80
+ end
81
+
71
82
  unity_versions.sort_by! { |v| v[:major_version] }
72
83
  select_unity_versions = unity_versions.select { |v| v[:major_version] == unity_major_version } if unity_major_version
73
- if select_unity_versions.empty?
84
+ if select_unity_versions.nil? || select_unity_versions.empty?
74
85
  if force_change_version
75
86
  return unity_versions.last[:path]
76
87
  else
@@ -87,12 +98,21 @@ module Pindo
87
98
 
88
99
  def extract_version_from_path(path)
89
100
  # macOS路径格式: /Applications/Unity/Hub/Editor/2021.3.45f1/Unity.app/Contents/MacOS/Unity
101
+ # macOS路径格式(变体): /Applications/Unity/Hub/Editor/2021.3.45f1c1/Unity.app/Contents/MacOS/Unity
90
102
  # Windows路径格式: C:/Program Files/Unity/Hub/Editor/2021.3.45f1/Editor/Unity.exe
91
- if match = path.match(/Editor\/([\d.]+[a-zA-Z]\d+)\//)
92
- match[1]
93
- else
94
- nil
103
+ # Windows路径格式(变体): C:/Program Files/Unity/Hub/Editor/2021.3.45f1c1/Editor/Unity.exe
104
+
105
+ # 尝试匹配 macOS 路径格式
106
+ if match = path.match(/Editor\/([\d.]+[a-zA-Z]\d+(?:c\d+)?)\//)
107
+ return match[1]
108
+ end
109
+
110
+ # 尝试匹配 Windows 路径格式
111
+ if match = path.match(/([\d.]+[a-zA-Z]\d+(?:c\d+)?)\/Editor\//)
112
+ return match[1]
95
113
  end
114
+
115
+ nil
96
116
  end
97
117
 
98
118
  public
data/lib/pindo/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Pindo
2
2
 
3
- VERSION = "5.0.2"
3
+ VERSION = "5.0.3"
4
4
 
5
5
  class VersionCheck
6
6
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pindo
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-24 00:00:00.000000000 Z
10
+ date: 2025-02-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: claide