-
Notifications
You must be signed in to change notification settings - Fork 30
/
flutterw
executable file
·57 lines (49 loc) · 1.57 KB
/
flutterw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env sh
##############################################################################
##
## Flutter start up script for UN*X
## Version: v0.7.1
## Date: 2018-08-09 14:26:47
##
## Use this flutter wrapper to bundle Flutter within your project to make
## sure everybody builds with the same version.
##
## Read about the install and uninstall process in the README on GitHub
## https://github.com/passsy/flutter_wrapper
##
## Inspired by gradle-wrapper.
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
FLUTTER_DIR_NAME='.flutter'
FLUTTER_DIR="$APP_HOME/$FLUTTER_DIR_NAME"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
# submodule starting with "-" are not initialized
init_status=`git submodule | grep .flutter | cut -c 1`
# Fix not initialized flutter submodule
if [ "$init_status" = "-" ]; then
echo ".flutter submodule not initizlied. Initializing..."
git submodule update --init .flutter
fi
# Wrapper tasks done, call flutter binay with all args
set -e
"$FLUTTER_DIR/bin/flutter" "$@"