forked from MoonsideGames/FNA-VSCode-Template
				
			update install script
							parent
							
								
									ce9c3cd89e
								
							
						
					
					
						commit
						d22954e503
					
				
							
								
								
									
										28
									
								
								install.sh
								
								
								
								
							
							
						
						
									
										28
									
								
								install.sh
								
								
								
								
							|  | @ -7,6 +7,8 @@ | ||||||
| # Get the directory of this script | # Get the directory of this script | ||||||
| MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | 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 | # Checks if git is installed | ||||||
| function checkGit() | function checkGit() | ||||||
| { | { | ||||||
|  | @ -21,6 +23,7 @@ function checkGit() | ||||||
| function pullFNA() | function pullFNA() | ||||||
| { | { | ||||||
|     checkGit |     checkGit | ||||||
|  |     git submodule add https://github.com/FNA-XNA/FNA.git | ||||||
|     echo "Updating to the latest git version of FNA..." |     echo "Updating to the latest git version of FNA..." | ||||||
| 	git submodule update --init --recursive | 	git submodule update --init --recursive | ||||||
| 	if [ $? -eq 0 ]; then | 	if [ $? -eq 0 ]; then | ||||||
|  | @ -31,6 +34,20 @@ function pullFNA() | ||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Pulls Encompass from git | ||||||
|  | function pullEncompass() | ||||||
|  | { | ||||||
|  |     checkGit | ||||||
|  |     echo "Updating to latest git version of Encompass..." | ||||||
|  |     git submodule add https://gitea.moonside.games/MoonsideGames/encompass-cs.git | ||||||
|  |     if [ $? -eq 0 ]; then | ||||||
|  |         echo "Finished updating!" | ||||||
|  |     else | ||||||
|  |         echo >&2 "ERROR: Unable to update." | ||||||
|  |         exit 1 | ||||||
|  |     fi | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # Downloads and extracts prepackaged archive of native libraries ("fnalibs") | # Downloads and extracts prepackaged archive of native libraries ("fnalibs") | ||||||
| function getLibs() | function getLibs() | ||||||
| { | { | ||||||
|  | @ -59,7 +76,6 @@ function getLibs() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| getLibs | getLibs | ||||||
| pullFNA |  | ||||||
| 
 | 
 | ||||||
| read -p "Enter your project name or 'exit' to quit: " newProjectName | read -p "Enter your project name or 'exit' to quit: " newProjectName | ||||||
| if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then | if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then | ||||||
|  | @ -74,6 +90,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) | 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 | for file in "${files[@]}"; do | ||||||
|     sed -i -e "s/ProjectName/$newProjectName/g" "./$file" |     sed -i -e "s/ProjectName/$newProjectName/g" "./$file" | ||||||
|  |     rm ./${file}-e | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
| mv ./ProjectName.Core.sln "./$newProjectName.Core.sln" | mv ./ProjectName.Core.sln "./$newProjectName.Core.sln" | ||||||
|  | @ -83,5 +100,12 @@ mv ./ProjectName/ProjectName.Framework.csproj "./ProjectName/$newProjectName.Fra | ||||||
| mv ./ProjectName/ProjectNameGame.cs ./ProjectName/${newProjectName}Game.cs | mv ./ProjectName/ProjectNameGame.cs ./ProjectName/${newProjectName}Game.cs | ||||||
| mv ./ProjectName "./$newProjectName" | mv ./ProjectName "./$newProjectName" | ||||||
| rm ./install.sh | rm ./install.sh | ||||||
|  | rm ./LICENSE | ||||||
| 
 | 
 | ||||||
| echo "Project $newProjectName created at $(readlink -f $NEW_PROJECT_DIR)" | rm -rf .git | ||||||
|  | git init | ||||||
|  | pullFNA | ||||||
|  | pullEncompass | ||||||
|  | 
 | ||||||
|  | echo "Project $newProjectName created at: " | ||||||
|  | echo $(readlinkf $NEW_PROJECT_DIR) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue