diff --git a/Scripts/bootstrap b/Scripts/bootstrap index 8d44d58..34a1120 100755 --- a/Scripts/bootstrap +++ b/Scripts/bootstrap @@ -140,10 +140,19 @@ rewrite "$W/README.md" \ # Xcode project: PBXProject name + directory. if [ -d "$XCODEPROJ" ]; then rewrite "$XCODEPROJ/project.pbxproj" -e "s/\"Site\"/\"${NAME}\"/g" - if command -v git >/dev/null 2>&1 && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - git mv "$XCODEPROJ" "./${NAME}.xcodeproj" 2>/dev/null || mv "$XCODEPROJ" "./${NAME}.xcodeproj" - else - mv "$XCODEPROJ" "./${NAME}.xcodeproj" + + # Skip the rename when the display name was left as the placeholder: the + # source and destination are then the same path, and `mv dir dir` fails + # (it moves the directory into itself), which would abort the run here — + # after the rewrites, but before the self-cleanup. + XCODEPROJ_RENAMED="./${NAME}.xcodeproj" + + if [ "$XCODEPROJ" != "$XCODEPROJ_RENAMED" ]; then + if command -v git >/dev/null 2>&1 && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + git mv "$XCODEPROJ" "$XCODEPROJ_RENAMED" 2>/dev/null || mv "$XCODEPROJ" "$XCODEPROJ_RENAMED" + else + mv "$XCODEPROJ" "$XCODEPROJ_RENAMED" + fi fi fi