Skip to content

Commit bf9e898

Browse files
committed
fix running with clean clone
1 parent 21ba1f8 commit bf9e898

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/setup_bundle_id

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ DEFAULT_TEAM_ID="AKK7J2GV64"
1212
if [ -f "$TEAM_ID_FILE" ]; then
1313
rm "$TEAM_ID_FILE"
1414
fi
15+
mkdir -p "$(dirname "$TEAM_ID_FILE")"
1516
echo "// This file was automatically generated, do not edit directly." > "$TEAM_ID_FILE"
1617
echo "" >> "$TEAM_ID_FILE"
1718
echo "DEVELOPMENT_TEAM=$DEFAULT_TEAM_ID" >> "$TEAM_ID_FILE"
@@ -27,7 +28,6 @@ TEAM_INFO_RESULT=""
2728

2829
function get_team_info_array() {
2930
local XCODEPREFS="$HOME/Library/Preferences/com.apple.dt.Xcode.plist"
30-
local team_info
3131

3232
# Get all team infos and format as key-value pairs
3333
local all_keys=($(/usr/libexec/PlistBuddy -c "Print :IDEProvisioningTeamByIdentifier" "$XCODEPREFS" | grep ' = Array' | awk '{print $1}'))
@@ -46,7 +46,12 @@ function get_team_info_array() {
4646

4747
# Fallback to old method: IDEProvisioningTeams
4848
local found=false
49-
TEAM_KEYS=(`/usr/libexec/PlistBuddy -c "Print :IDEProvisioningTeams" "$XCODEPREFS" | perl -lne 'print $1 if /^ (\S*) =/'`)
49+
# Check if IDEProvisioningTeams exists before trying to read it
50+
if /usr/libexec/PlistBuddy -c "Print :IDEProvisioningTeams" "$XCODEPREFS" > /dev/null 2>&1; then
51+
TEAM_KEYS=(`/usr/libexec/PlistBuddy -c "Print :IDEProvisioningTeams" "$XCODEPREFS" | perl -lne 'print $1 if /^ (\S*) =/'`)
52+
else
53+
TEAM_KEYS=()
54+
fi
5055
for KEY in ${TEAM_KEYS[@]}; do
5156
i=0
5257
while true ; do

0 commit comments

Comments
 (0)