diff --git a/pages/photos.sh b/pages/photos.sh
index ede75ef..83f66a8 100755
--- a/pages/photos.sh
+++ b/pages/photos.sh
@@ -7,12 +7,13 @@ DIR=`dirname $0`
header="\n\t\n\t
"
footer="\n\t\n"
-# Move to where this script exists.
-cd $DIR
+# Move to the main directory.
+cd $DIR/..
-# Where resources are from the current directory.
-HELPER_DIR=../pages/helpers
-mainpage=../files/photos/index.html
+# Where resources are from the main directory.
+HELPER_DIR=./pages/helpers
+PHOTOS_DIR=./files/photos
+mainpage=$PHOTOS_DIR/index.html
# Use the cached version if available.
if [[ -e $mainpage ]]; then
@@ -40,9 +41,9 @@ echo -e "\t\t\t" >> $mainpage
echo -e "\t\t" >> $mainpage
# Display the album names descending.
-ls files/photos/ | sort -r | while read album; do
+ls $PHOTOS_DIR/ | sort -r | while read album; do
# Skip files, only read directories.
- if [[ ! -d files/photos/$album ]]; then
+ if [[ ! -d $PHOTOS_DIR/$album ]]; then
continue
fi
@@ -61,7 +62,7 @@ ls files/photos/ | sort -r | while read album; do
# Create index page for each photo ALBUM based on its contents.
page=""
- subpage="files/photos/$album/index.html"
+ subpage="$PHOTOS_DIR/$album/index.html"
$HELPER_DIR/body_open.php > $subpage
# Add a back button
@@ -74,7 +75,7 @@ ls files/photos/ | sort -r | while read album; do
echo -e "\t\t" >> $subpage
echo -e "\t\t" >> $subpage
- ls files/photos/$album/* | sort | while read photo; do
+ ls $PHOTOS_DIR/$album/* | sort | while read photo; do
# Do not include the index page.
if [[ $photo == *"index.html" ]]; then
continue