Fixed broken workout directory check for the first start (#4410)

Fix1:
appsettings->value default fallback "0" if no fallback value was given.
So a new GoldenCheetah installation will always use path "0" until a
workout directory was set in the settings.
We now use an empty string as fallback to get the condition working
again

Fix2:
Instead of using the athlete->home parent folder, the old code returned
the parent's parent folder. Until a workout directory was set in the
settings, the user had to navigate to the (hidden) athletes folder
everytime by hand.
This commit is contained in:
enngq11k
2023-10-31 15:18:31 +01:00
committed by GitHub
parent b095b403bd
commit c2f440c1c0

View File

@@ -178,8 +178,9 @@ MainWindow::MainWindow(const QDir &home)
// if no workout directory is configured, default to the
// top level GoldenCheetah directory
if (appsettings->value(NULL, GC_WORKOUTDIR).toString() == "")
appsettings->setValue(GC_WORKOUTDIR, QFileInfo(context->athlete->home->root().canonicalPath() + "/../").canonicalPath());
if (appsettings->value(NULL, GC_WORKOUTDIR, "").toString() == ""){
appsettings->setValue(GC_WORKOUTDIR, QFileInfo(context->athlete->home->root().canonicalPath()).canonicalPath());
}
/*----------------------------------------------------------------------
* GUI setup