diff --git a/README.md b/README.md index 8341995..fe11b9d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,16 @@ placing a link of the following kind in the markup: print "Open with PhpStorm"; ?> +Added in ability to path map to local files from docker/devilbox. + +Edit phpstorm-url-handler file, find the following lines: + + find="/shared/httpd/" + + replace="/home/michael/public_html/"; + +change the content of the find variable with the path the files are located on docker/devilbox, and change the content of the replace variable with the path to the local files. + ## Command-line usage FILE="/path/to/filename.php" diff --git a/phpstorm-url-handler b/phpstorm-url-handler index 318f13c..048d625 100755 --- a/phpstorm-url-handler +++ b/phpstorm-url-handler @@ -7,15 +7,19 @@ # @license GPL # @author Stefan Auditor -arg=${1} +urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } +arg=$(urldecode "${1}") pattern=".*file(:\/\/|\=)(.*)&line=(.*)" +find="/shared/httpd/" +replace="/home/michael/public_html/"; + # Get the file path. file=$(echo "${arg}" | sed -r "s/${pattern}/\2/") - +file=$(echo "${file/${find}/${replace}}") # Get the line number. line=$(echo "${arg}" | sed -r "s/${pattern}/\3/") - + # Check if phpstorm|pstorm command exist. if type phpstorm > /dev/null; then /usr/bin/env phpstorm --line "${line}" "${file}"