Page 1 of 1

Qt4 GUI: setting "CELESTIA_DATA_DIR" breaks celestia fixed

Posted: 25.08.2011, 22:22
by refsteff
Hello,

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