-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update activate #392
Update activate #392
Conversation
Moved "export KCTF_CTF_DIR" into macOS check to use grealpath instead of realpath which doesn't seem supported.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Moved "export KCTF_CTF_DIR" into macOS check to use grealpath instead of realpath which doesn't seem supported.
Hi, thanks for the pull request! Could you make it check which one exists and then put that in an environment variable maybe? |
Real path does exist on my system. I should correct my previous statement to be that how realpath is used, does not seem to be have the intended behavior. In my environment, when I source the kctf/activate after a clean download I see:
I can update my commit to include the follow so it will work in both environments.
|
ah, that makes sense. I.e. maybe something like this should work? export KCTF_CTF_DIR="$(realpath "$(dirname "$(dirname "${BASH_SOURCE-$0}")")")" In a quick test, that seems to handle all the cases of relative and absolute paths with a symlinked kctf dir ... Thinking more about it, it needs some handling of script_dir="$(dirname "${BASH_SOURCE-$0}")"
if [[ "$script_dir" == "." ]]; then
script_dir="../."
fi
export KCTF_CTF_DIR="$(realpath "$(dirname "${script_dir}")")"
unset script_dir |
That solution worked as well in my initial testing. I'll update my branch to reflect the suggestion. |
Sounds good. Please let me know once you updated it. |
Just updated the code. |
Moved "export KCTF_CTF_DIR" into macOS check to use grealpath instead of realpath which doesn't seem supported by default.