Browse Source

fix: Correct syntax errors in Cursor app modification script

- Replaced incorrect closing braces `}` with proper shell script `fi` syntax
- Fixed conditional statement terminations in file modification functions
- Improved script readability and prevented potential syntax errors
- Maintained consistent error handling and logging approach
pull/231/head v0.0.101
煎饼果子卷鲨鱼辣椒 4 months ago
parent
commit
150eb4ac95
  1. 12
      scripts/run/cursor_mac_id_modifier.sh

12
scripts/run/cursor_mac_id_modifier.sh

@ -301,7 +301,7 @@ modify_cursor_app_files() {
if [ ! -d "$CURSOR_APP_PATH" ]; then if [ ! -d "$CURSOR_APP_PATH" ]; then
log_error "未找到 Cursor.app,请确认安装路径: $CURSOR_APP_PATH" log_error "未找到 Cursor.app,请确认安装路径: $CURSOR_APP_PATH"
return 1 return 1
}
fi
# 创建临时工作目录 # 创建临时工作目录
local timestamp=$(date +%Y%m%d_%H%M%S) local timestamp=$(date +%Y%m%d_%H%M%S)
@ -384,7 +384,7 @@ modify_cursor_app_files() {
if [ -z "$uuid_pos" ]; then if [ -z "$uuid_pos" ]; then
log_warn "$file 中未找到 IOPlatformUUID" log_warn "$file 中未找到 IOPlatformUUID"
continue continue
}
fi
# 从 UUID 位置向前查找 switch # 从 UUID 位置向前查找 switch
local before_uuid=${content:0:$uuid_pos} local before_uuid=${content:0:$uuid_pos}
@ -392,7 +392,7 @@ modify_cursor_app_files() {
if [ -z "$switch_pos" ]; then if [ -z "$switch_pos" ]; then
log_warn "$file 中未找到 switch 关键字" log_warn "$file 中未找到 switch 关键字"
continue continue
}
fi
# 构建新的文件内容 # 构建新的文件内容
if printf "%sreturn crypto.randomUUID();\n%s" "${content:0:$switch_pos}" "${content:$switch_pos}" > "$file"; then if printf "%sreturn crypto.randomUUID();\n%s" "${content:0:$switch_pos}" "${content:$switch_pos}" > "$file"; then
@ -411,7 +411,7 @@ modify_cursor_app_files() {
log_error "未能成功修改任何文件" log_error "未能成功修改任何文件"
rm -rf "$temp_dir" rm -rf "$temp_dir"
return 1 return 1
}
fi
# 重新签名应用 # 重新签名应用
log_info "重新签名应用..." log_info "重新签名应用..."
@ -431,7 +431,7 @@ modify_cursor_app_files() {
log_error "创建备份失败" log_error "创建备份失败"
rm -rf "$temp_dir" rm -rf "$temp_dir"
return 1 return 1
}
fi
# 替换原应用 # 替换原应用
log_info "安装修改版应用..." log_info "安装修改版应用..."
@ -440,7 +440,7 @@ modify_cursor_app_files() {
mv "$backup_app" "$CURSOR_APP_PATH" mv "$backup_app" "$CURSOR_APP_PATH"
rm -rf "$temp_dir" rm -rf "$temp_dir"
return 1 return 1
}
fi
# 清理临时文件 # 清理临时文件
rm -rf "$temp_dir" rm -rf "$temp_dir"

Loading…
Cancel
Save