Skip to content

Commit

Permalink
Fix: Create Output Directories if Don't Exist (#9)
Browse files Browse the repository at this point in the history
* Replaced NotEmpty Check with Negated Empty Check

* Fix: Changed IN_PATH to F_DIR for IN_DIR Without Wild Card

IN_PATH would be empty if the IN_DIR is an actual directory and not a wild card. Therefore, it is important to be equal to F_DIR in order to be removed when adding the Sub Directory for the Output Directory

* Fix: Create Nested Directory Output if Doesn't Exist
  • Loading branch information
nizarmah committed Jul 8, 2020
1 parent 953d987 commit 39cc9ce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ output_name () {
# but if it is just a `js/`, we need its full path
# not just the dirname, but also the basename with it
if [ -d "${in_dir}" ]; then
in_path=$( readlink $in_dir )
in_path=$f_dir
fi

f_path=$f_dir
if [ ! -z $out_dir ]; then
f_path="$out_dir/${f_dir#"$in_path"}"

mkdir -p $f_path
fi

echo "$f_path/$f_name.min$f_extn" | xargs readlink -m
Expand Down Expand Up @@ -100,7 +102,7 @@ if [ ! -z $INPUT_OUTPUT ]; then
out_dir="$dir/$INPUT_OUTPUT"
fi

if [ -n "$out_dir" ]; then
if [ ! -z $out_dir ]; then
# create output directories if they don't exist
mkdir -p $out_dir
fi
Expand Down

0 comments on commit 39cc9ce

Please sign in to comment.