-
Notifications
You must be signed in to change notification settings - Fork 916
Use absolutize_paths to make userdir and path absolute
#8998
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
Conversation
|
I have a concern that this is done in a different way to how other paths are absolutized in the launcher script. I also don't think we can rely on |
|
@jtulach please have a look at this code: netbeans/nb/ide.launcher/unix/netbeans Lines 36 to 39 in d2e1813
I think this is what @neilcsmith-net meant by "a different way to how other paths are absolutized". My understanding is, that this saves the current directory into variable This might not be the most efficient way, but it looks sane to me and is small enough to be copyable (IMHO). As a test you can create #!/bin/bash
old=`pwd`
cd "$1"
resolved=`pwd`
cd "$old"
echo "Resolved path: '$resolved'";In my test session my shell is opened in Which is the expected answer. |
|
There is also - netbeans/nb/ide.launcher/unix/netbeans Lines 126 to 134 in d2e1813
|
7a8296c to
74c8ee4
Compare
netbeans$ git diff
diff --git nb/ide.launcher/unix/netbeans nb/ide.launcher/unix/netbeans
index 3f65db67a3..a62ff77da3 100644
--- nb/ide.launcher/unix/netbeans
+++ nb/ide.launcher/unix/netbeans
@@ -33,10 +33,6 @@ while [ -h "$PRG" ]; do
done
progdir=`dirname "$PRG"`
-old=`pwd`
-cd "$progdir"/..
-basedir=`pwd`
-cd "$old"
case "`uname -s -m`" in
Darwin*)
@@ -68,6 +64,7 @@ absolutize_paths() {
}
# $HOME can be used as it is present on mac OS and
+basedir=`echo "$progdir"/.. | absolutize_paths`
BASEDIR=$basedir
if [ -f "$basedir"/etc/netbeans.conf ] ; then
|
matthiasblaesing
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Looks sane to me. Did a quick local run and both PATH and NETBEANS_USERDIR have absolute paths.
74c8ee4 to
514b2d1
Compare
absolutize_paths to make userdir and path absolute
|
If you invoke the launcher with a relative path, that relative path is set to
NETBEANS_USERDIR. The moment you change the local directory in the terminal this invalidates the reference as now the relative path resolves to a different directory.On Linux invoked as
./nbbuild/netbeans/bin/netbeans --userdir xwe used to get:This PR "absolutizes" both paths. The
NETBEANS_USERDIRas well as the path to thebindirectory.Gets printed in the NetBeans terminal window now.