Qt4 GUI: setting "CELESTIA_DATA_DIR" breaks celestia fixed

Report bugs, bug fixes and workarounds here.
Topic author
Posts: 17
Joined: 30.07.2011
With us: 8 years 2 months

Qt4 GUI: setting "CELESTIA_DATA_DIR" breaks celestia fixed

Post #1by refsteff » 25.08.2011, 22:22


I wanted to start celestia (svn 5166) with a different data directory to see if my original costs performance.
The command line interface is not ready (yet) :wink: , so I was setting the environment variable CELESTIA_DATA_DIR
to point to the new directory. I got the message: "Celestia is unable to run because the data directory was not found...". :o

This is the fix:

Code: Select all

diff -urN celestia.org/src/celestia/qt/qtappwin.cpp celestia/src/celestia/qt/qtappwin.cpp
--- celestia.org/src/celestia/qt/qtappwin.cpp   2011-08-19 16:04:59.000000000 +0200
+++ celestia/src/celestia/qt/qtappwin.cpp   2011-08-26 00:00:35.291329014 +0200
@@ -162,15 +162,15 @@
                              const QStringList& qExtrasDirectories)
    QString celestia_data_dir = QString::fromLocal8Bit(::getenv("CELESTIA_DATA_DIR"));
-   if (celestia_data_dir.isEmpty()) {
-      QString celestia_data_dir = CONFIG_DATA_DIR;
-      QDir::setCurrent(celestia_data_dir);
-   } else {
+   if (celestia_data_dir.isEmpty())
+      celestia_data_dir = CONFIG_DATA_DIR;
+   if (!QDir(celestia_data_dir).exists()) {
       QMessageBox::critical(0, "Celestia",
          _("Celestia is unable to run because the data directroy was not "
            "found, probably due to improper installation."));
-         exit(1);
+      exit(1);
+   QDir::setCurrent(celestia_data_dir);
     // Get the config file name
     string configFileName;

As you can see I change the sanity check to proof the dir because celestia_data_dir couldn't be empty.

See you
Specs: OpenSUSE 11.2 (modified), nVidia Geforce 9400 GT, Intel E7500, celestia svn 5166 Qt4

Return to “Bugs”

Who is online

Users browsing this forum: 6 guests