From e0b3f4fa82ed852711d78b38e3df9634546075db Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sat, 18 Jan 2014 21:04:55 +0100 Subject: [PATCH] Strip .gz from output filenames. --- src/ctbin/ctbin.cpp | 12 ++++++++---- src/ctmodel/ctmodel.cpp | 12 ++++++++---- src/ctselect/ctselect.cpp | 10 +++++++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/ctbin/ctbin.cpp b/src/ctbin/ctbin.cpp index 1b0c2ca..9a61cc5 100644 --- a/src/ctbin/ctbin.cpp +++ b/src/ctbin/ctbin.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctbin - CTA data binning tool * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2013 by Juergen Knoedlseder * + * copyright (C) 2010-2014 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -759,9 +759,10 @@ void ctbin::free_members(void) * * @param[in] filename Input file name. * - * This method converts an input filename into an output filename by - * prepending the prefix specified by m_prefix to the input filename. Any - * path will be stripped from the input filename. + * Converts an input filename into an output filename by prepending the + * prefix stored in the member m_prefix to the input filename. Any path will + * be stripped from the input filename. Also a trailing ".gz" will be + * stripped. ***************************************************************************/ std::string ctbin::set_outfile_name(const std::string& filename) const { @@ -771,6 +772,9 @@ std::string ctbin::set_outfile_name(const std::string& filename) const // The last path element is the filename std::string outname = m_prefix + elements[elements.size()-1]; + // Strip any ".gz" + outname = gammalib::strip_chars(outname, ".gz"); + // Return output filename return outname; } diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index ac371f0..708ba05 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctmodel - CTA counts model tool * * ----------------------------------------------------------------------- * - * copyright (C) 2012-2013 by Juergen Knoedlseder * + * copyright (C) 2012-2014 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -761,9 +761,10 @@ void ctmodel::free_members(void) * * @param[in] filename Input file name. * - * This method converts an input filename into an output filename by - * prepending the prefix specified by m_prefix to the input filename. Any - * path will be stripped from the input filename. + * Converts an input filename into an output filename by prepending the + * prefix stored in the member m_prefix to the input filename. Any path will + * be stripped from the input filename. Also a trailing ".gz" will be + * stripped. ***************************************************************************/ std::string ctmodel::set_outfile_name(const std::string& filename) const { @@ -772,6 +773,9 @@ std::string ctmodel::set_outfile_name(const std::string& filename) const // The last path element is the filename std::string outname = m_prefix + elements[elements.size()-1]; + + // Strip any ".gz" + outname = gammalib::strip_chars(outname, ".gz"); // Return output filename return outname; diff --git a/src/ctselect/ctselect.cpp b/src/ctselect/ctselect.cpp index 2188386..75fc5a8 100644 --- a/src/ctselect/ctselect.cpp +++ b/src/ctselect/ctselect.cpp @@ -846,9 +846,10 @@ std::string ctselect::check_infile(const std::string& filename) const * * @param[in] filename Input file name. * - * This converts an input filename into an output filename by prepending a - * prefix to the input filename. Any path will be stripped from the input - * filename. + * Converts an input filename into an output filename by prepending the + * prefix stored in the member m_prefix to the input filename. Any path will + * be stripped from the input filename. Also a trailing ".gz" will be + * stripped. ***************************************************************************/ std::string ctselect::set_outfile_name(const std::string& filename) const { @@ -857,6 +858,9 @@ std::string ctselect::set_outfile_name(const std::string& filename) const // The last path element is the filename std::string outname = m_prefix + elements[elements.size()-1]; + + // Strip any ".gz" + outname = gammalib::strip_chars(outname, ".gz"); // Return output filename return outname; -- libgit2 0.21.4