downloader: use global divelog object

The save_dives() function saves dives from the global divelog object.
Use the same object when calling parse_file() so that we don't end up
with an empty output log file.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
This commit is contained in:
Richard Fuchs 2024-01-27 09:09:25 -05:00 committed by Dirk Hohndel
parent caf2f8c102
commit 0ee5c8f03a

View file

@ -41,7 +41,6 @@ int main(int argc, char **argv)
QStringList files;
QStringList importedFiles;
QStringList arguments = QCoreApplication::arguments();
struct divelog log;
// set a default logfile name for libdivecomputer so we always get a logfile
logfile_name = strdup("subsurface-downloader.log");
@ -92,7 +91,7 @@ int main(int argc, char **argv)
filesOnCommandLine = !files.isEmpty() || !importedFiles.isEmpty();
if (!files.isEmpty()) {
qDebug() << "loading dive data from" << files;
parse_file(qPrintable(files.first()), &log);
parse_file(qPrintable(files.first()), &divelog);
}
print_files();
if (!quit) {