Clifford Wolf:

Improved handling of examplesdir on linux
	Updated scripts/release-linux.sh



git-svn-id: http://svn.clifford.at/openscad/trunk@441 b57f626f-c46c-0410-a088-ec61d464b74c
stl_dim openscad-2010.02
clifford 2010-02-19 09:51:35 +00:00
parent 48ca7d1856
commit 05ce9d89b5
3 changed files with 24 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
# WARNING: This script might only work with the authors setup...
VERSION=2010.01
VERSION=2010.02
set -ex
@ -25,7 +25,7 @@ exec $libdir/openscad "$@"
EOT
cp openscad release/lib/openscad/
gcc -o chrpath_linux chrpath_linux.c
gcc -o chrpath_linux scripts/chrpath_linux.c
./chrpath_linux -d release/lib/openscad/openscad
ldd openscad | sed -re 's,.* => ,,; s,[\t ].*,,;' -e '/Qt|boost/ { p; d; };' \
@ -58,9 +58,9 @@ if [ ! -d "$prefix" ]; then
read -p "press enter to continue> "
fi
mkdir -p "$prefix"/{bin,lib/openscad}
mkdir -p "$prefix"/{bin,lib/openscad,share/openscad/examples}
if ! [ -w "$prefix"/bin/ -a -w "$prefix"/lib/ ]; then
if ! [ -w "$prefix"/bin/ -a -w "$prefix"/lib/openscad -a -w "$prefix"/share/openscad ]; then
echo "You does not seam to have write permissions for prefix \`$prefix'!" >&2
echo "Maybe you should have run this install script using \`sudo'?" >&2
exit 1
@ -72,6 +72,9 @@ cp -rv bin/. "$prefix"/bin/
echo "Copying application and libraries..."
cp -rv lib/. "$prefix"/lib/
echo "Copying examples..."
cp -rv examples/. "$prefix"/share/openscad/examples/
echo "Installation finished. Have a nice day."
EOT

View File

@ -198,11 +198,20 @@ MainWindow::MainWindow(const char *filename)
this, SLOT(clearRecentFiles()));
if (!examplesdir.isEmpty()) {
bool found_example = false;
QStringList examples = QDir(examplesdir).entryList(QStringList("*.scad"),
QDir::Files | QDir::Readable, QDir::Name);
foreach (const QString &ex, examples) {
this->menuExamples->addAction(ex, this, SLOT(actionOpenExample()));
found_example = true;
}
if (!found_example) {
delete this->menuExamples;
this->menuExamples = NULL;
}
} else {
delete this->menuExamples;
this->menuExamples = NULL;
}
// Edit menu

View File

@ -165,6 +165,14 @@ int main(int argc, char **argv)
#ifdef Q_WS_MAC
exdir.cd("../Resources"); // Examples can be bundled
if (!exdir.exists("examples")) exdir.cd("../../..");
#endif
#ifdef linux
if (exdir.cd("../../examples")) {
examplesdir = exdir.path();
} else
if (exdir.cd("../../share/openscad/examples")) {
examplesdir = exdir.path();
} else
#endif
if (exdir.cd("examples")) {
examplesdir = exdir.path();