Skip to content

Commit 2b803a2

Browse files
Fix newtheme-popos.sh script location detection
1 parent 0ae4c74 commit 2b803a2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### Unreleased
22

33
* Demo: Prevent spaces in theme-info link
4+
* Fix newtheme-popos.sh script location detection
45

56
### 9.4.5: 2024-10-25
67

bin/newtheme-popos.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ SCRIPT_VERSION='1.0.0 (2023-09-29)'
99
CURRENTFILE=`basename $0`
1010

1111
# Determine scripts location to get imports right
12-
if [ "$CURRENTFILE" = "newtheme.sh" ]; then
12+
if [ "$CURRENTFILE" = "newtheme-popos.sh" ]; then
1313
SCRIPTS_LOCATION="$( pwd )"
1414
source ${SCRIPTS_LOCATION}/tasks/variables.sh
1515
source ${SCRIPTS_LOCATION}/tasks/header.sh
1616
exit
1717
else
1818
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
1919
ORIGINAL_FILE=$( readlink $DIR/$CURRENTFILE )
20-
SCRIPTS_LOCATION=$( dirname $ORIGINAL_FILE )
20+
# Check if ORIGINAL_FILE is empty before calling dirname
21+
if [ -n "$ORIGINAL_FILE" ]; then
22+
SCRIPTS_LOCATION=$( dirname "$ORIGINAL_FILE" )
23+
else
24+
echo "Error: Could not determine original file location"
25+
exit 1
26+
fi
2127
fi
2228

2329
# Final note about server requirements

0 commit comments

Comments
 (0)