Commit 5f98c0f8 authored by Wuttke, Joachim's avatar Wuttke, Joachim Committed by Wuttke, Joachim
Browse files

Let LoadDataFromFile initialize all parameters, including dataset_name

parent 20470e41
......@@ -18,6 +18,7 @@
#include "core/data/DataSet.h"
#include "core/loader/IDataReader.h" // inherits from
#include "core/raw/DataKeys.h"
#include "base/utils/Path.h" // fileBasename
#include <fstream>
#include <stdexcept>
......@@ -26,7 +27,7 @@ namespace ohkl {
//! Minimal meta data set, to supplement binary raw data in RawDataReader.
struct RawDataReaderParameters {
std::string dataset_name = ohkl::kw_datasetDefaultName;
std::string dataset_name = kw_datasetDefaultName;
double wavelength = 0.0;
double delta_omega = 0.0;
double delta_chi = 0.0;
......@@ -39,6 +40,8 @@ struct RawDataReaderParameters {
void LoadDataFromFile(std::string file)
{
dataset_name = fileBasename(file);
std::size_t pos1 = file.find_last_of("/");
std::size_t pos0 = (file.substr(0, pos1 - 1)).find_last_of("/");
std::size_t pos2 = file.find_last_of(".");
......
......@@ -15,7 +15,6 @@
#include "gui/models/Session.h"
#include "base/utils/Logger.h"
#include "base/utils/Path.h" // fileBasename
#include "core/data/DataSet.h"
#include "core/data/DataTypes.h"
#include "core/detector/Detector.h"
......@@ -318,7 +317,6 @@ bool Session::loadRawData()
return false;
ohkl::RawDataReaderParameters parameters;
parameters.dataset_name = ohkl::fileBasename(filenames[0]);
parameters.LoadDataFromFile(filenames.at(0));
const QStringList& datanames_pre{currentProject()->getDataNames()};
RawDataDialog dialog(parameters, datanames_pre);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment