cshargextcap
cshargextcap copied to clipboard
packetfix-hander: don't hardcode Wireshark.app installation path into the apple script
Current packetfix-handler expects Wireshark to be installed under /Applications/
which is not always the case, e.g. macports
installs it under the /Applications/MacPorts/
Couldn't find the sources of AppleScript to make a PR :) so, here are the changes to make it a bit better than it is:
do shell script "/Applications/Wireshark.app/Contents/MacOS/Wireshark -k -i packetflix -o gui.window_title:\"" & title & "\" -o extcap.packetflix.url:\"" & thisURL & "\""
to something like
set wiresharkBundleId to id of application "Wireshark"
set theWorkspace to current application's NSWorkspace's sharedWorkspace()
set wiresharkPath to ((theWorkspace's URLForApplicationWithBundleIdentifier:wiresharkBundleId)'s |path|()) as text
do shell script wiresharkPath & "/Contents/MacOS/Wireshark -k -i packetflix -o gui.window_title:\"" & title & "\" -o extcap.packetflix.url:\"" & thisURL & "\""
This is not my solution, btw, just found a nice one from https://www.macscripter.net/t/determining-path-to-application-without-using-path-to-command/73645/5