From efbe72600072c851d757085709cb71262f58a54f Mon Sep 17 00:00:00 2001
From: Olivier Langella <olivier.langella@u-psud.fr>
Date: Fri, 31 Aug 2018 11:52:43 +0200
Subject: [PATCH] xtpcpp (0.2.21-3) stretch

---
 _clang-format      | 30 +++++++++++++++---------------
 debian/changelog   |  6 ++++++
 src/core/msrun.cpp | 27 +++++++++++++++++++--------
 3 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/_clang-format b/_clang-format
index 6968ff9d3..74e1bac42 100644
--- a/_clang-format
+++ b/_clang-format
@@ -1,4 +1,5 @@
-Language:        Cpp
+---
+Language: Cpp
 # BasedOnStyle:  LLVM
 AccessModifierOffset: 0
 AlignAfterOpenBracket: Align
@@ -15,14 +16,10 @@ AllowShortIfStatementsOnASingleLine: false
 AllowShortLoopsOnASingleLine: false
 # Deprecated AlwaysBreakAfterDefinitionReturnType: All
 AlwaysBreakAfterReturnType: AllDefinitions
-
-
-
-
-AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
-BinPackArguments: true
-BinPackParameters: true
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: false
+BinPackParameters: false
 BraceWrapping:   
   AfterClass:      false
   AfterControlStatement: false
@@ -35,13 +32,13 @@ BraceWrapping:
   BeforeCatch:     false
   BeforeElse:      false
   IndentBraces:    false
+BreakAfterJavaFieldAnnotations: false
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: GNU
 BreakBeforeTernaryOperators: true
-BreakConstructorInitializersBeforeComma: true
-BreakAfterJavaFieldAnnotations: false
+BreakConstructorInitializersBeforeComma: false
 BreakStringLiterals: true
-ColumnLimit:     80
+ColumnLimit:		80
 CommentPragmas:  '^ IWYU pragma:'
 ConstructorInitializerAllOnOneLineOrOnePerLine: true
 ConstructorInitializerIndentWidth: 2
@@ -63,12 +60,12 @@ IndentCaseLabels: true
 IndentWidth:     2
 IndentWrappedFunctionNames: false
 JavaScriptQuotes: Leave
-JavaScriptWrapImports: true
 KeepEmptyLinesAtTheStartOfBlocks: true
+# Language: Cpp
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 2
-NamespaceIndentation: All
+NamespaceIndentation: Inner
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
@@ -82,15 +79,18 @@ PointerAlignment: Right
 ReflowComments:  true
 SortIncludes:    false
 SpaceAfterCStyleCast: false
+# SpaceAfterTemplateKeyword: false
 SpaceBeforeAssignmentOperators: true
 SpaceBeforeParens: Never
 SpaceInEmptyParentheses: false
 SpacesBeforeTrailingComments: 1
 SpacesInAngles:  false
-SpacesInContainerLiterals: false
 SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: false
 SpacesInParentheses: false
 SpacesInSquareBrackets: false
 Standard:        Cpp11
 TabWidth:        2
 UseTab:          Never
+...
+
diff --git a/debian/changelog b/debian/changelog
index 63786d0dd..d26abc407 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xtpcpp (0.2.21-3) stretch; urgency=medium
+
+  * smart file path guess
+
+ -- Olivier Langella <olivier.langella@u-psud.fr>  Fri, 31 Aug 2018 11:49:39 +0200
+
 xtpcpp (0.2.21-2) stretch; urgency=medium
 
   * gui text fix (proteins => peptides)
diff --git a/src/core/msrun.cpp b/src/core/msrun.cpp
index 91f517f2f..0ec6f36e7 100644
--- a/src/core/msrun.cpp
+++ b/src/core/msrun.cpp
@@ -87,10 +87,11 @@ MsRun::getMsRunStatistics(MsRunStatistics param) const
 bool
 MsRun::findMsRunFile()
 {
-
-  QFileInfo file(this->getFilename());
-  QString basename     = file.baseName();
-  QString onlyfilename = file.fileName();
+  if(_msrun_reader_sp != nullptr)
+    return true;
+  QFileInfo file_original(this->getFilename());
+  QString basename     = file_original.baseName();
+  QString onlyfilename = file_original.fileName();
   QSettings settings;
   QString path = settings.value("path/mzdatadir", "").toString();
 
@@ -109,12 +110,20 @@ MsRun::findMsRunFile()
           if(onlyfilename == file.fileName())
             {
               this->setFilename(file.absoluteFilePath());
-              if(_msrun_reader_sp == nullptr)
+              try
                 {
-                  _msrun_reader_sp = pappso::MsRunReaderFactory::getInstance()
-                                       .buildPwizMsRunReaderSp(*this);
+                  if(_msrun_reader_sp == nullptr)
+                    {
+                      _msrun_reader_sp =
+                        pappso::MsRunReaderFactory::getInstance()
+                          .buildPwizMsRunReaderSp(*this);
 
-                  return true;
+                      return true;
+                    }
+                }
+              catch(pappso::PappsoException &error)
+                {
+                  _msrun_reader_sp = nullptr;
                 }
             }
           if(file.fileName().contains(onlyfilename))
@@ -138,6 +147,8 @@ MsRun::findMsRunFile()
             }
         }
     }
+  this->setFilename(file_original.absoluteFilePath());
+  _msrun_reader_sp = nullptr;
   return false;
 }
 
-- 
GitLab