diff --git a/src/celestia/celestiacore.cpp b/src/celestia/celestiacore.cpp index eda8b0155..8397fda29 100644 --- a/src/celestia/celestiacore.cpp +++ b/src/celestia/celestiacore.cpp @@ -4765,7 +4765,7 @@ bool CelestiaCore::saveScreenShot(const fs::path& filename, ContentType type) co return false; } -void CelestiaCore::setLogFile(fs::path &fn) +void CelestiaCore::setLogFile(const fs::path &fn) { m_logfile = std::ofstream(fn.string()); if (m_logfile.good()) diff --git a/src/celestia/celestiacore.h b/src/celestia/celestiacore.h index 79c7f7d1b..0e78931b0 100644 --- a/src/celestia/celestiacore.h +++ b/src/celestia/celestiacore.h @@ -322,7 +322,7 @@ class CelestiaCore // : public Watchable void notifyWatchers(int); - void setLogFile(fs::path&); + void setLogFile(const fs::path&); class Alerter { diff --git a/src/celestia/qt/qtappwin.cpp b/src/celestia/qt/qtappwin.cpp index 97a5dbc6b..27837bfa7 100644 --- a/src/celestia/qt/qtappwin.cpp +++ b/src/celestia/qt/qtappwin.cpp @@ -191,6 +191,10 @@ void CelestiaAppWindow::init(const QString& qConfigFileName, const QStringList& qExtrasDirectories, const QString& logFilename) { + QDir logPath = QDir(logFilename); + if (!logPath.makeAbsolute()) + QMessageBox::warning(0, "Celestia", _("Error getting path for log filename!")); + QString celestia_data_dir = QString::fromLocal8Bit(::getenv("CELESTIA_DATA_DIR")); if (celestia_data_dir.isEmpty()) { @@ -233,7 +237,7 @@ void CelestiaAppWindow::init(const QString& qConfigFileName, if (!logFilename.isEmpty()) { - fs::path fn(logFilename.toStdString()); + fs::path fn = logPath.absolutePath().toStdString(); m_appCore->setLogFile(fn); }