OBS-URL: https://build.opensuse.org/package/show/science/celestia?expand=0&rev=8
48 lines
1.9 KiB
Diff
48 lines
1.9 KiB
Diff
diff -ruNp a/src/celestia/qt/qtmain.cpp b/src/celestia/qt/qtmain.cpp
|
|
--- a/src/celestia/qt/qtmain.cpp
|
|
+++ b/src/celestia/qt/qtmain.cpp
|
|
@@ -53,6 +53,9 @@ int main(int argc, char *argv[])
|
|
CelestiaCore::initLocale();
|
|
#ifdef ENABLE_NLS
|
|
QString localeDir = LOCALEDIR;
|
|
+ QString appimageDir = QString::fromLocal8Bit(::getenv("APPDIR"));
|
|
+ if (!appimageDir.isEmpty())
|
|
+ localeDir = appimageDir + "/" + localeDir;
|
|
bindtextdomain("celestia", localeDir.toUtf8().data());
|
|
bind_textdomain_codeset("celestia", "UTF-8");
|
|
bindtextdomain("celestia-data", localeDir.toUtf8().data());
|
|
diff -ruNp a/src/celestia/celestiacore.cpp b/src/celestia/celestiacore.cpp
|
|
--- a/src/celestia/celestiacore.cpp
|
|
+++ b/src/celestia/celestiacore.cpp
|
|
@@ -117,12 +117,19 @@ bool is_valid_directory(const fs::path&
|
|
|
|
bool ReadLeapSecondsFile(const fs::path& path, std::vector<astro::LeapSecondRecord> &leapSeconds)
|
|
{
|
|
- std::ifstream file(path);
|
|
+ fs::path myPath;
|
|
+ const auto *appimageDir = getenv("APPDIR");
|
|
+ if (appimageDir != nullptr)
|
|
+ myPath = fs::path(appimageDir);
|
|
+ myPath += path;
|
|
+
|
|
+ std::ifstream file(myPath);
|
|
if (!file.good())
|
|
{
|
|
- GetLogger()->error(_("Failed to open leapseconds file {}\n"), path);
|
|
+ GetLogger()->error(_("Failed to open leapseconds file {}\n"), myPath);
|
|
return false;
|
|
}
|
|
+ GetLogger()->info(_("Leapseconds file {} found\n"), myPath);
|
|
|
|
std::string s;
|
|
for (int line = 1; std::getline(file, s); line++)
|
|
@@ -139,7 +146,7 @@ bool ReadLeapSecondsFile(const fs::path&
|
|
if (std::sscanf(ptr, "%" SCNuLEAST32 " %i", ×tamp, &seconds) != 2)
|
|
{
|
|
GetLogger()->error(_("Failed to parse leapseconds file {}, line {}, column {}\n"),
|
|
- path, line, ptr - &s[0]);
|
|
+ myPath, line, ptr - &s[0]);
|
|
leapSeconds.clear();
|
|
return false;
|
|
}
|