Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "npm run build_example_gallery && npm run build_web && npm run start_web_server",
"build_web": "./build_web.sh",
"build_example_gallery": "node src/BuildGallery.js example-images dist/gallery",
"build_example_gallery": "node src/BuildGallery.js example-images dist/web/gallery",
"start_web_server": "./run_server.sh dist/"
},
"dependencies": {
Expand Down
9 changes: 4 additions & 5 deletions run_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ if [ ! -z ${2} ]; then
PORT="${2}"
fi

# check for python, 'which' will exit with 1 if it doesn't exist, which is stored in ${?}
type python &> /dev/null
if [ "1" = "${?}" ]; then
# check for python -- command -v exits non-zero if the executable isn't on PATH.
PYTHON="$(command -v python3 || command -v python)"
if [ -z "${PYTHON}" ]; then
echo "Python isn't installed or accessible, can't host web server."
echo "Install it via something like apt on linux, homebrew on macos, or cygwin on windows"
exit 1
Expand All @@ -44,5 +44,4 @@ echo
echo "http://localhost:${PORT}/"
echo

cd "${HOST_DIR}" && python -m http.server "${PORT}"

cd "${HOST_DIR}" && "${PYTHON}" -m http.server "${PORT}"