Skip to content

Commit

Permalink
Fix newtheme-popos.sh script location detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ronilaukkarinen committed Nov 13, 2024
1 parent 0ae4c74 commit 2b803a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Unreleased

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

### 9.4.5: 2024-10-25

Expand Down
10 changes: 8 additions & 2 deletions bin/newtheme-popos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ SCRIPT_VERSION='1.0.0 (2023-09-29)'
CURRENTFILE=`basename $0`

# Determine scripts location to get imports right
if [ "$CURRENTFILE" = "newtheme.sh" ]; then
if [ "$CURRENTFILE" = "newtheme-popos.sh" ]; then
SCRIPTS_LOCATION="$( pwd )"
source ${SCRIPTS_LOCATION}/tasks/variables.sh
source ${SCRIPTS_LOCATION}/tasks/header.sh
exit
else
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ORIGINAL_FILE=$( readlink $DIR/$CURRENTFILE )
SCRIPTS_LOCATION=$( dirname $ORIGINAL_FILE )
# Check if ORIGINAL_FILE is empty before calling dirname
if [ -n "$ORIGINAL_FILE" ]; then
SCRIPTS_LOCATION=$( dirname "$ORIGINAL_FILE" )
else
echo "Error: Could not determine original file location"
exit 1
fi
fi

# Final note about server requirements
Expand Down

0 comments on commit 2b803a2

Please sign in to comment.