Use relative path for data and config on macOS platform
parent
19d36c0d2d
commit
589face93e
|
@ -231,14 +231,19 @@ endif()
|
|||
|
||||
add_definitions(
|
||||
-DVERSION="${VERSION}"
|
||||
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
|
||||
-DPACKAGE="celestia"
|
||||
-DCONFIG_DATA_DIR="${FULL_DATADIR}"
|
||||
-DHIP_DATA_DIR="${FULL_DATADIR}"
|
||||
-DSPLASH_DIR="${FULL_DATADIR}/splash/"
|
||||
-DGIT_COMMIT=${GIT_COMMIT}
|
||||
)
|
||||
|
||||
if(NOT NATIVE_OSX_APP)
|
||||
add_definitions(
|
||||
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
|
||||
-DCONFIG_DATA_DIR="${FULL_DATADIR}"
|
||||
-DHIP_DATA_DIR="${FULL_DATADIR}"
|
||||
-DSPLASH_DIR="${FULL_DATADIR}/splash/"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
|
|
|
@ -203,7 +203,13 @@ void CelestiaAppWindow::init(const QString& qConfigFileName,
|
|||
QString celestia_data_dir = QString::fromLocal8Bit(::getenv("CELESTIA_DATA_DIR"));
|
||||
|
||||
if (celestia_data_dir.isEmpty()) {
|
||||
QString celestia_data_dir = CONFIG_DATA_DIR;
|
||||
#ifdef NATIVE_OSX_APP
|
||||
// On macOS data directory is in a fixed position relative to the application bundle
|
||||
QString dataDir = QApplication::applicationDirPath() + "/../Resources";
|
||||
#else
|
||||
QString dataDir = CONFIG_DATA_DIR;
|
||||
#endif
|
||||
QString celestia_data_dir = dataDir;
|
||||
QDir::setCurrent(celestia_data_dir);
|
||||
} else if (QDir(celestia_data_dir).isReadable()) {
|
||||
QDir::setCurrent(celestia_data_dir);
|
||||
|
|
|
@ -71,7 +71,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
ParseCommandLine();
|
||||
|
||||
QPixmap pixmap(SPLASH_DIR "splash.png");
|
||||
#ifdef NATIVE_OSX_APP
|
||||
// On macOS data directory is in a fixed position relative to the application bundle
|
||||
QString splashDir = QApplication::applicationDirPath() + "/../Resources/splash/";
|
||||
#else
|
||||
QString splashDir = SPLASH_DIR;
|
||||
#endif
|
||||
QPixmap pixmap(splashDir + "splash.png");
|
||||
QSplashScreen splash(pixmap);
|
||||
splash.setMask(pixmap.mask());
|
||||
|
||||
|
@ -81,9 +87,15 @@ int main(int argc, char *argv[])
|
|||
// Gettext integration
|
||||
setlocale(LC_ALL, "");
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
bindtextdomain("celestia", LOCALEDIR);
|
||||
#ifdef NATIVE_OSX_APP
|
||||
// On macOS locale directory is in a fixed position relative to the application bundle
|
||||
QString localeDir = QApplication::applicationDirPath() + "/../Resources/locale";
|
||||
#else
|
||||
QString localeDir = LOCALEDIR;
|
||||
#endif
|
||||
bindtextdomain("celestia", localeDir.toUtf8().data());
|
||||
bind_textdomain_codeset("celestia", "UTF-8");
|
||||
bindtextdomain("celestia_constellations", LOCALEDIR);
|
||||
bindtextdomain("celestia_constellations", localeDir.toUtf8().data());
|
||||
bind_textdomain_codeset("celestia_constellations", "UTF-8");
|
||||
textdomain("celestia");
|
||||
|
||||
|
|
Loading…
Reference in New Issue