Skip to content

Commit a354abc

Browse files
[fix] Better path handling in gapic.sh (#226)
1 parent be6ad16 commit a354abc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

packages/gapic-generator/gapic.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ if [ -z "$IMAGE" ] || [ -z "$IN" ] || [ -z "$OUT" ]; then
6464
fi
6565

6666
# Ensure that the input directory exists (and is a directory).
67-
if ! [ -d $IN ]; then
68-
>&2 echo "Directory does not exist: $IN"
67+
if ! [ -d "${PROTO_PATH}/$IN" ]; then
68+
>&2 echo "Directory does not exist: ${PROTO_PATH}/$IN"
6969
exit 2
7070
fi
7171

@@ -85,10 +85,19 @@ if [ "$(ls -A $OUT )"]; then
8585
>&2 echo "Warning: Output directory is not empty."
8686
fi
8787

88+
# Convert IN and OUT to absolute paths for Docker
89+
CWD=`pwd`
90+
cd ${PROTO_PATH}/$IN
91+
ABS_IN=`pwd`
92+
cd $CWD
93+
cd $OUT
94+
ABS_OUT=`pwd`
95+
cd $CWD
96+
8897
# Generate the client library.
8998
docker run \
90-
--mount type=bind,source=${PROTO_PATH}/${IN},destination=/in/${IN},readonly \
91-
--mount type=bind,source=$OUT,destination=/out \
99+
--mount type=bind,source=${ABS_IN},destination=/in/${IN},readonly \
100+
--mount type=bind,source=${ABS_OUT},destination=/out \
92101
--rm \
93102
--user $UID \
94103
$IMAGE \

0 commit comments

Comments
 (0)