diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-02-19 09:51:35 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-02-19 09:51:35 (GMT) |
commit | 05ce9d89b563083b062df82c50eee533555ceaf4 (patch) | |
tree | 844eb9844b9f0a078daf7dce3b55d6e764aa9001 /src | |
parent | 48ca7d1856a0c030ce1bf536f88cd51304ff8b1e (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwin.cc | 9 | ||||
-rw-r--r-- | src/openscad.cc | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index b277d1f..fc26799 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -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 diff --git a/src/openscad.cc b/src/openscad.cc index f2e1afc..0afc39e 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -166,6 +166,14 @@ int main(int argc, char **argv) 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(); } |