12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/bin/sh
- CHOSEN_PLATFORM=$1
- # Check if a parameter was passed
- if [ -z $CHOSEN_PLATFORM ]
- then
- echo "No chosen platform was passed. Please enter iOS, Android or Web as platforms"
- exit 1
- fi
- #Check for valid platforms
- if [ $CHOSEN_PLATFORM != "iOS" ] && [ $CHOSEN_PLATFORM != "Android" ] && [ $CHOSEN_PLATFORM != "Web" ]
- then
- echo "Unknown Platform. Please enter iOS, Android or Web as platforms"
- exit 1
- fi
- #Detect current platform by inspecting the current available Libraries
- if [ -d "Library_iOS" ]
- then
- if [ -d "Library_Android" ]
- then
- CURRENT_PLATFORM="Web"
- else
- CURRENT_PLATFORM="Android"
- fi
- else
- CURRENT_PLATFORM="iOS"
- fi
- echo "Current platform is $CURRENT_PLATFORM"
- #Swap libraries accordingly
- if [ $CURRENT_PLATFORM = $CHOSEN_PLATFORM ]
- then
- echo "You are already on $CURRENT_PLATFORM"
- else
- echo "Changed platform to $CHOSEN_PLATFORM"
- mv "Library" "Library_$CURRENT_PLATFORM"
- mv "Library_$CHOSEN_PLATFORM" "Library"
- fi
|