From 6d5ee0891d4a16f6571fd140dad55ea33b730b4a Mon Sep 17 00:00:00 2001
From: Evan Hemsley <evan@moonside.games>
Date: Sat, 11 Jul 2020 14:07:50 -0700
Subject: [PATCH] modify install script for better git behavior

---
 install.sh | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/install.sh b/install.sh
index a7fe7a1..7ee7766 100755
--- a/install.sh
+++ b/install.sh
@@ -7,6 +7,8 @@
 # Get the directory of this script
 MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
+readlinkf(){ perl -MCwd -e 'print Cwd::abs_path shift' "$1";}
+
 # Checks if git is installed
 function checkGit()
 {
@@ -17,10 +19,14 @@ function checkGit()
     fi
 }
 
-# Pulls FNA from the git master branch
+# Pulls FNA from github
 function pullFNA()
 {
     checkGit
+    git submodule add https://github.com/FNA-XNA/FNA.git
+    cd FNA
+    git checkout 20.07
+    cd ..
     echo "Updating to the latest git version of FNA..."
 	git submodule update --init --recursive
 	if [ $? -eq 0 ]; then
@@ -59,7 +65,6 @@ function getLibs()
 }
 
 getLibs
-pullFNA
 
 read -p "Enter your project name or 'exit' to quit: " newProjectName
 if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then
@@ -74,6 +79,7 @@ cd "$NEW_PROJECT_DIR"
 files=(ProjectName.Core.sln ProjectName.Framework.sln .gitignore ProjectName/ProjectName.Core.csproj ProjectName/ProjectName.Framework.csproj ProjectName/ProjectNameGame.cs ProjectName/Program.cs .vscode/tasks.json .vscode/launch.json)
 for file in "${files[@]}"; do
     sed -i -e "s/ProjectName/$newProjectName/g" "./$file"
+    rm ./${file}-e
 done
 
 mv ./ProjectName.Core.sln "./$newProjectName.Core.sln"
@@ -83,5 +89,16 @@ mv ./ProjectName/ProjectName.Framework.csproj "./ProjectName/$newProjectName.Fra
 mv ./ProjectName/ProjectNameGame.cs ./ProjectName/${newProjectName}Game.cs
 mv ./ProjectName "./$newProjectName"
 rm ./install.sh
+rm ./LICENSE
 
-echo "Project $newProjectName created at $(readlink -f $NEW_PROJECT_DIR)"
+rm -rf .git
+git init
+pullFNA
+
+echo "Project $newProjectName created at: "
+
+if [ "$(uname)" == "Darwin" ]; then
+    echo $(readlinkf $NEW_PROJECT_DIR)
+else
+    echo $(readlink -f $NEW_PROJECT_DIR)
+fi