소스 검색

Updates script to handle relative paths

Brandon Slack 13 년 전
부모
커밋
663c371d8c
2개의 변경된 파일24개의 추가작업 그리고 14개의 파일을 삭제
  1. 22 14
      gameplay-newproject.sh
  2. 2 0
      gameplay/gameplay.xcodeproj/project.pbxproj

+ 22 - 14
gameplay-newproject.sh

@@ -102,6 +102,7 @@ if [[ "$className" == "" ]]; then
 fi
 echo 
 
+
 echo
 echo "7. Enter the project path."
 echo
@@ -127,24 +128,31 @@ if [ -e $projPath ]; then
 	exit -2
 fi
 
-# Generate relative path from project folder to gameplay folder
-if [[ ${projPath:0:1} == "/" ]]; then
-	gpPathAbs=`pwd`
-	common_path=$projPath
-	back=
-	while [ "${gpPathAbs#$common_path}" = "${gpPathAbs}" ]; do
-		common_path=$(dirname $common_path)
-		back="../${back}"
-	done
-	gpPath=${back}${gpPathAbs#$common_path/}
-else
-	gpPath=$projPath
-fi
-
 # Make required source folder directories
+mkdir -p "$projPath"
 mkdir -p "$projPath/src"
 mkdir -p "$projPath/res"
 
+if [[ ${projPath:0:1} != "/" ]]; then
+	currPwd=`pwd`
+	projPath=`cd $projPath; pwd`
+	`cd $currPwd`	
+fi
+
+# Generate relative path from project folder to gameplay folder
+gpPathAbs=`pwd`
+common_path=$projPath
+back=
+while [ "${gpPathAbs#$common_path}" = "${gpPathAbs}" ]; do
+	common_path=$(dirname $common_path)
+	back="../${back}"
+done
+gpPath=${back}${gpPathAbs#$common_path/}
+if [[ ${gpPathAbs} == ${common_path} ]]; then
+	gpPath=${back}
+fi
+
+
 # Below does copy, then uses 'sed' with -i for inplace editing
 # Alternative below uses sed to do a input then output skipping the copy
 # sed "s/TEMPLATE_PROJECT/$projectName/g" "gameplay-template/gameplay-template.vcxproj" > "$projPath/$projName.vcxproj"

+ 2 - 0
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -1434,6 +1434,7 @@
 					"../external-deps/libpng/include",
 					"../external-deps/bullet/include",
 					"../external-deps/oggvorbis/include",
+					./gameplay,
 				);
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1475,6 +1476,7 @@
 					"../external-deps/libpng/include",
 					"../external-deps/bullet/include",
 					"../external-deps/oggvorbis/include",
+					./gameplay,
 				);
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",