Skip to content

Commit fae0be0

Browse files
committed
Replace paths relative to execution with paths relative to script
1 parent e46a987 commit fae0be0

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scripts/whats_left_builtin_items.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
#!/bin/bash
22
set -euo pipefail
33

4+
# paths where the script is located
5+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
6+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
7+
8+
DATA_DIR="$PROJECT_ROOT/_data"
9+
TEMP_FILE="$DATA_DIR/whats_left.temp"
10+
OUTPUT_DIR="$DATA_DIR/whats_left"
11+
OUTPUT_FILE="$OUTPUT_DIR/builtin_items.csv"
12+
413
# create directory if it doesn't exist
5-
mkdir -p ../_data/whats_left
14+
mkdir -p "$OUTPUT_DIR"
615

716
# exit violently if the temp file does not exist
8-
if [ ! -f ../_data/whats_left.temp ]; then
9-
echo "error: input file ../_data/whats_left.temp not found" >&2
17+
if [ ! -f "$TEMP_FILE" ]; then
18+
echo "error: input file $TEMP_FILE not found" >&2
1019
exit 1
1120
fi
1221

1322
# generate the CSV file for builtin items from the temp file
14-
awk -f - ../_data/whats_left.temp > ../_data/whats_left/builtin_items.csv <<'EOF'
23+
awk -f - "$TEMP_FILE" > "$OUTPUT_FILE" <<'EOF'
1524
BEGIN {
1625
OFS=","
1726
print "builtin,name,is_inherited"

0 commit comments

Comments
 (0)