Use absolutize_paths to make userdir and path absolute#8998
Use absolutize_paths to make userdir and path absolute#8998jtulach merged 1 commit intoapache:masterfrom
absolutize_paths to make userdir and path absolute#8998Conversation
|
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.
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.