I put LightTable in /opt/LightTable
By default, when you install the text editor LightTable in ubuntu 14.04 64 bits, you don't have an "open with LightTable" when you right-click the file you want to open with it.
Therefore I created a file /home/theuser/.local/share/applications/LightTable.desktop containing :
[Desktop Entry]
Name=LighTable Text Editor
Comment=Edit text files
Exec=/opt/LightTable/LightTable %f
Terminal=false
Type=Application
Icon=/opt/LightTable/core/img/lticon.png
Categories=Utility;TextEditor;
StartupNotify=true
MimeType=text/plain
so that a "open with LightTable" appears when I want open a file with LighTable. Now, the problems begin. When I do this, it only opens LightTable, as if I only ran the script
/opt/LightTable/LightTable
Therefore I went to see the script :
#!/bin/bash
BIN=ltbin
HERE=`dirname $(readlink -f $0)`
LIBUDEV_0=libudev.so.0
LIBUDEV_1=libudev.so.1
add_udev_symlinks() {
# 64-bit specific; look for libudev.so.0, and if that can't be
# found link it to libudev.so.1
FOLDERS="/lib64 /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib"
for folder in $FOLDERS; do
if [ -f "${folder}/${LIBUDEV_0}" ]; then
return 0
fi
done
for folder in $FOLDERS; do
if [ -f "${folder}/${LIBUDEV_1}" ]; then
ln -snf "${folder}/${LIBUDEV_1}" "${HERE}/${LIBUDEV_0}"
return 0
fi
done
echo "${LIBUDEV_0} or ${LIBUDEV_1} not found in any of ${FOLDERS}".
exit 1
}
add_udev_symlinks
ARGS="$@"
CORRECTED=${ARGS//-/<d>}
CORRECTED=${CORRECTED// /<s>}
if [ -t 0 ] && [ $# != 0 ]; then
#We're in a terminal...
LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" $HERE/$BIN "<d><d>dir=`pwd`<s>$CORRECTED" &
else
#We were double clicked
LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" $HERE/$BIN &
fi
and replaced its ending if/else/fi by a simple :
LD_LIBRARY_PATH="$HERE:$LD_LIBRARY_PATH" $HERE/$BIN "<d><d>dir=`pwd`<s>$CORRECTED" &
so that the right behaviour (the one when opening a file from the terminal) is chosen.
This almost made my day. Now, if I double-click a file or right-click it and select "open with LightTable", the file is indeed opened in LightTable... but : this is true only if the file name and the path to the file have no blank space in their names.
If the file named "the file" is in the path thepath without space in it, when I double-click it, it opens two blank files "the" and "file" in LightTable. The same behavior is constated if thepath has space(s) in it.
Would someone have an idea ? I guess I should correct the bash script, but I'm not an expert in it. (I am not even sure that the script is really wrong...)
Thanks in advance
MEF