Created
November 12, 2011 09:27
-
-
Save shyiko/1360291 to your computer and use it in GitHub Desktop.
JD-GUI Launcher for Intellij IDEA (via External Tools)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JDGUI_BIN=$1; FILE_PATH=$2 | |
DELIMITER_INDEX=$(awk -v a="$FILE_PATH" -v b="!/" 'BEGIN{print index(a,b)}') | |
if [ $DELIMITER_INDEX -eq 0 ]; then | |
$JDGUI_BIN $FILE_PATH | |
else | |
JAR_FILE=${FILE_PATH:0:$DELIMITER_INDEX-1} | |
CLASS_RELATIVE_LOCATION=${FILE_PATH:$DELIMITER_INDEX+1} | |
if [[ $CLASS_RELATIVE_LOCATION == "" ]]; then | |
$JDGUI_BIN $JAR_FILE | |
else | |
TEMPORARY_DIR=$(mktemp -d) | |
cd $TEMPORARY_DIR | |
unzip -u $JAR_FILE $CLASS_RELATIVE_LOCATION | |
$JDGUI_BIN $CLASS_RELATIVE_LOCATION | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IDE Settings -> External Tools -> Add...