#!/bin/zsh

# Utility script to generate a compatibility version of the xcodeproj file that
# could be opened in older versions of Xcode. Currently it simply replaces the
# objectVersion with an older one because it actually just works, but older
# versions of Xcode just complains when they see a newer objectVersion number.
#
# Note that this compatibility version mostly helps in opening the project in
# Xcode. Command-line building works regardless of which version you use.
#
# Run this from the src/ folder.

mkdir -p MacVim/MacVim_xcode8.xcodeproj
cp MacVim/MacVim.xcodeproj/project.pbxproj MacVim/MacVim_xcode8.xcodeproj/project.pbxproj
sed -i "" -e 's/objectVersion = .*;/objectVersion = 47;/g' MacVim/MacVim_xcode8.xcodeproj/project.pbxproj
sed -i "" -e 's/^{/\/\/ Note: Generated by `gen-xcodeproj-compat`. No not edit directly.\n{/g' MacVim/MacVim_xcode8.xcodeproj/project.pbxproj
