Skip to content

Commit 6a647fc

Browse files
committed
fix:路径对但大小写匹配错误
1 parent fe86cc8 commit 6a647fc

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

FyneApp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Website = "https://github.com/oneclickvirt/ecs"
22

33
[Details]
44
Icon = "logo.png"
5-
Name = "GoECS"
5+
Name = "goecs"
66
ID = "com.oneclickvirt.goecs"
77
Version = "0.0.1"
88
Build = 1

embedding/embed_android.go

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,12 @@ func ExtractECSBinary() (string, error) {
172172
}
173173
}
174174

175-
// 库名称固定为 libgoecs.so
176-
libraryName := "libgoecs.so"
175+
// 可能的库名称(考虑不同的命名约定)
176+
libraryNames := []string{
177+
"libgoecs.so", // 标准小写
178+
"libGoECS.so", // Fyne 可能使用的驼峰命名
179+
"libGOECS.so", // 全大写变体
180+
}
177181

178182
// 尝试的子目录(Android ABI 名称)
179183
abiDirs := []string{
@@ -192,7 +196,7 @@ func ExtractECSBinary() (string, error) {
192196
abiDirs = append(abiDirs, "x86")
193197
}
194198

195-
// 尝试所有可能的路径组合
199+
// 尝试所有可能的路径和名称组合
196200
var checkedPaths []string
197201

198202
if err == nil {
@@ -202,20 +206,24 @@ func ExtractECSBinary() (string, error) {
202206
baseDir = filepath.Join(libDir, abiDir)
203207
}
204208

205-
ecsPath := filepath.Join(baseDir, libraryName)
206-
checkedPaths = append(checkedPaths, ecsPath)
209+
// 尝试所有可能的文件名
210+
for _, libraryName := range libraryNames {
211+
ecsPath := filepath.Join(baseDir, libraryName)
212+
checkedPaths = append(checkedPaths, ecsPath)
207213

208-
// 添加详细的调试信息
209-
if info, err := os.Stat(ecsPath); err == nil && !info.IsDir() {
210-
// 找到文件,确保有执行权限
211-
if err := os.Chmod(ecsPath, 0755); err != nil {
212-
// 在某些 Android 版本上可能无法修改权限,但这通常不是问题
214+
// 添加详细的调试信息
215+
if info, err := os.Stat(ecsPath); err == nil && !info.IsDir() {
216+
// 找到文件,确保有执行权限
217+
if err := os.Chmod(ecsPath, 0755); err != nil {
218+
// 在某些 Android 版本上可能无法修改权限,但这通常不是问题
219+
}
220+
debugInfo += fmt.Sprintf("✓ 找到文件: %s\n", ecsPath)
221+
return ecsPath, nil
222+
} else if err == nil && info.IsDir() {
223+
debugInfo += fmt.Sprintf(" 警告: %s 是目录而不是文件\n", ecsPath)
224+
} else {
225+
debugInfo += fmt.Sprintf(" 未找到: %s (错误: %v)\n", ecsPath, err)
213226
}
214-
return ecsPath, nil
215-
} else if err == nil && info.IsDir() {
216-
debugInfo += fmt.Sprintf(" 警告: %s 是目录而不是文件\n", ecsPath)
217-
} else {
218-
debugInfo += fmt.Sprintf(" 未找到: %s (错误: %v)\n", ecsPath, err)
219227
}
220228

221229
// 如果这是一个目录,列出其内容

0 commit comments

Comments
 (0)