Hi Christian,
that's what I already replied to Jens and the list - naturally, any script that finds the script path must be emdedded into all startup scripts. Which for this script means that it has to be executed in a subshell since it changes the pwd... there was some shell syntax to do that, but I do not remember it currently.
Kind regards, Ralf
On Thursday 03 November 2011 22:42:34 Christian Grün wrote:
Hi Jens, hi Ralf,
Just put the script somewhere in BaseX' scripts folder and replace `readlink -e` by this script. Completely based on POSIX commands and options, so should work on all UNIXes.
I'm feeling clumsy.. How will the script file be found by the main script if the absolute path has not been evaluated yet?
Christian ___________________________
On Tue, Oct 25, 2011 at 3:53 PM, Jens Erat jens.erat@uni-konstanz.de
wrote:
Hi Christian and Ralf,
was building around `readlink -e` myself until I found out somebody on [stackoverflow][1] actually had the same problem and some working solution, too. (Found it after I realized having problems with pwd not resolving symlinks in folders - had written essentially the same code apart from whitespace and variable naming…)
#!/bin/sh
TARGET_FILE=$1
cd `dirname $TARGET_FILE` TARGET_FILE=`basename $TARGET_FILE`
# Iterate down a (possible) chain of symlinks while [ -L "$TARGET_FILE" ] do TARGET_FILE=`readlink $TARGET_FILE` cd `dirname $TARGET_FILE` TARGET_FILE=`basename $TARGET_FILE` done
# Compute the canonicalized name by finding the physical path # for the directory we're in and appending the target file. PHYS_DIR=`pwd -P` RESULT=$PHYS_DIR/$TARGET_FILE echo $RESULT
Kind regards, Jens
-of-gnus-readlink-f-on-a-mac/1116890#1116890
-- Jens Erat
PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Am 25.10.2011 um 14:44 schrieb Christian Grün:
Ralf, thanks for the proposal - nitpicks are welcome as well ;) Before applying the changes, I'd like to have some feedback from Mac users, though.. Did someone try the alternative script?
Christian ___________________________
On Mon, Oct 24, 2011 at 8:06 PM, Ralf Jung ralfjung-e@gmx.de wrote:
Hi,
thanks a lot for this, the recent optimizations are really appreciated :D
Just one minor nitpick is left, from my side... if I create a symlink to one of the scripts in bin/, it stops to work. This is caused by the script looking for its class files in the folder the script is in, without taking symlinks into account. It can be fixed by replacing the PWD= line in each script with the following PWD="$(dirname "$(readlink -e "$0")")"
However, the -e option of readlink is a GNU extension, so non-Linux UNIXes (most notably Mac OS) will probably not support that option. If you want to support those OSes, it gets a bit more complicated, one could do something like this (which I did not test):
if readlink -e . &> /dev/null; then # readlink supports -e, use it PWD="$(dirname "$(readlink -e "$0")")" else # readlink does not support -e (e.g. Mac OS) # do not support being called through symlinks PWD="$(dirname "$0")" fi
With some shell magic it might also be possible to follow symlinks on Mac, but honestly I don't care enough about Mac to look into that ;-) . This keeps the status quo on Mac (and others), and makes things better on Linux.
Kind regards, Ralf
On Sunday 23 October 2011 21:48:03 Christian Grün wrote:
Hi all,
we are glad to announce BaseX 7.0.1, which is basically the result of your initial feedback on 7.0. Those are the most important changes:
DISTRIBUTIONS:
- Windows installer was updated to support latest features
- ZIP file was updated (initial config & directories added)
- Short directory names are chosen if config file resides in app.dir.
- Start scripts have been improved
XQUERY:
- much faster execution of count() when applied to opened databases
SERVER (http://docs.basex.org/wiki/Startup_Options#BaseX_HTTP_Server):
- Flag -c connects to an existing database server
- Flag -s specifies a port for stopping the HTTP server (Jetty)
- Flag -S starts the HTTP server as a service
- running write operations will be completed before server is stopped
API:
- Ruby, Python, PHP, Java: clients updated
Please check out the well-known links:
- Homepage: http://basex.org/
- Documentation: http://docs.basex.org/
- Snapshots: http://files.basex.org/releases/latest/
- Sources: https://github.com/BaseXdb
Enjoy the update!
Christian BaseX Team _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
-----BEGIN PGP SIGNATURE-----
iQEcBAEBAgAGBQJOpr9cAAoJENqoVWI6Xmj3ToEIAK2IVsRobanZSfPB1qpxoLai 0TY0DUOqz2IdVrsh/VlMSs/UT12cc4WbghEMKkBuQBrnOXi7MoHKc4lVzKIHWasb +TH2Xg9sUY76xeZ2Z5ouhAJcAMULgp00pp9FHGEAqCXxLvwPNMLfNWunpP2i8HN/ 6ITFLxci3bDC45x59R/aTbeqOeNO38spJKpnAg4cSOj4qyK7k9TH/kqz+B007VO/ H2LGQI+9uEKV7edhBozrzJGl+LDZDgubgPaylRdeSc6jA4fn+YrDWlE2DagOwWqM 5exsTL1Wv77XvrdxZvItrQULOXyuUrOb8oEmI1DM1ETqMA4wWjWg3PWYsv/J0ko= =GIId -----END PGP SIGNATURE-----