# HG changeset patch # User Michael Guravage # Date 2010-06-28 15:48:24 # Node ID d897bf22346f5bdd27b6dc3082842c4a1f57105f # Parent 03df53cdf78b1e2d2e28e48a626f6246af040022 Look for gpl3.txt in either an ancestor doc directory (Linux) or a decedent doc directory (Windows, via the binary installer). -- user: Michael Guravage branch 'default' changed src/ChangeLog changed src/canvas.cpp diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,11 @@ 2010-06-28 + * VirtualLeaf-install.nsi: Grab gpl3.txt from doc directory. - * canvas.cpp (gpl): move gpl3.txt back to the doc directory. + * canvas.cpp (gpl): gpl3.txt can be either in an ancestor doc + directory (Linux) or a decedent doc directory (Windows, via the + binary installer). * VirtualLeaf-install.nsi: Add VirtualLeaf doc directory. diff --git a/src/canvas.cpp b/src/canvas.cpp --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -84,6 +84,8 @@ static const std::string _module_id("$Id$"); +using namespace std; + // We use a global variable to save memory - all the brushes and pens in // the mesh are shared. @@ -954,8 +956,17 @@ void Main::gpl() QMessageBox::Information, 1, 0, 0, this, 0, FALSE ); QDir docDir(QApplication::applicationDirPath()); - docDir.cd("../doc"); + docDir.cd("../doc"); // Where Linux expects gpl3.txt QString path = docDir.filePath("gpl3.txt"); + if (!docDir.exists("gpl3.txt")){ + docDir = QApplication::applicationDirPath(); + docDir.cd("doc"); // Where Windows expects gpl3.txt + path = docDir.filePath("gpl3.txt"); + } + + // At this point path points either to the linux variant, which + // exists, or the windows variant, which may exist. Testing the + // ifstream object will determine whether we've found gpl3.txt. std::ifstream file(path.toStdString().c_str()); std::string str;