From 318def555f6634cd44918a165414a4f0c97be247 Mon Sep 17 00:00:00 2001 From: Anthony Lim <anthony.lim@stfc.ac.uk> Date: Fri, 6 Oct 2017 12:45:50 +0100 Subject: [PATCH] refs #20844 remove the path from label --- .../Muon/MuonAnalysisHelper.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp b/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp index adcc06d24cc..88c474816d5 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp @@ -973,11 +973,19 @@ Muon::DatasetParams parseWorkspaceName(const std::string &wsName) { */ void parseRunLabel(const std::string &label, std::string &instrument, std::vector<int> &runNumbers) { - const size_t instPos = label.find_first_of("0123456789"); - instrument = label.substr(0, instPos); - const size_t numPos = label.find_first_not_of('0', instPos); + size_t path = label.find_last_of("/"); + if (path == std::string::npos) { + size_t path = label.find_last_of('\\'); + } + std::string useThisLabel = label; + if (path != std::string::npos) { + useThisLabel = label.substr(0, path); + } + const size_t instPos = useThisLabel.find_first_of("0123456789"); + instrument = useThisLabel.substr(0, instPos); + const size_t numPos = useThisLabel.find_first_not_of('0', instPos); if (numPos != std::string::npos) { - std::string runString = label.substr(numPos, label.size()); + std::string runString = useThisLabel.substr(numPos, useThisLabel.size()); // sets of continuous ranges Mantid::Kernel::StringTokenizer rangeTokenizer( runString, ",", Mantid::Kernel::StringTokenizer::TOK_TRIM); -- GitLab