Open log file with relative name in the current dir not in the data dir
parent
f5f8d895db
commit
7b52f23c97
|
@ -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())
|
||||
|
|
|
@ -322,7 +322,7 @@ class CelestiaCore // : public Watchable<CelestiaCore>
|
|||
|
||||
void notifyWatchers(int);
|
||||
|
||||
void setLogFile(fs::path&);
|
||||
void setLogFile(const fs::path&);
|
||||
|
||||
class Alerter
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue