Commit e0b3f4fa82ed852711d78b38e3df9634546075db

Authored by Jürgen Knödlseder
1 parent c8236ee9

Strip .gz from output filenames.

src/ctbin/ctbin.cpp
1 1 /***************************************************************************
2 2 * ctbin - CTA data binning tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2013 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2014 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -759,9 +759,10 @@ void ctbin::free_members(void)
759 759 *
760 760 * @param[in] filename Input file name.
761 761 *
762   - * This method converts an input filename into an output filename by
763   - * prepending the prefix specified by m_prefix to the input filename. Any
764   - * path will be stripped from the input filename.
  762 + * Converts an input filename into an output filename by prepending the
  763 + * prefix stored in the member m_prefix to the input filename. Any path will
  764 + * be stripped from the input filename. Also a trailing ".gz" will be
  765 + * stripped.
765 766 ***************************************************************************/
766 767 std::string ctbin::set_outfile_name(const std::string& filename) const
767 768 {
... ... @@ -771,6 +772,9 @@ std::string ctbin::set_outfile_name(const std::string& filename) const
771 772 // The last path element is the filename
772 773 std::string outname = m_prefix + elements[elements.size()-1];
773 774  
  775 + // Strip any ".gz"
  776 + outname = gammalib::strip_chars(outname, ".gz");
  777 +
774 778 // Return output filename
775 779 return outname;
776 780 }
... ...
src/ctmodel/ctmodel.cpp
1 1 /***************************************************************************
2 2 * ctmodel - CTA counts model tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2013 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2014 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -761,9 +761,10 @@ void ctmodel::free_members(void)
761 761 *
762 762 * @param[in] filename Input file name.
763 763 *
764   - * This method converts an input filename into an output filename by
765   - * prepending the prefix specified by m_prefix to the input filename. Any
766   - * path will be stripped from the input filename.
  764 + * Converts an input filename into an output filename by prepending the
  765 + * prefix stored in the member m_prefix to the input filename. Any path will
  766 + * be stripped from the input filename. Also a trailing ".gz" will be
  767 + * stripped.
767 768 ***************************************************************************/
768 769 std::string ctmodel::set_outfile_name(const std::string& filename) const
769 770 {
... ... @@ -772,6 +773,9 @@ std::string ctmodel::set_outfile_name(const std::string& filename) const
772 773  
773 774 // The last path element is the filename
774 775 std::string outname = m_prefix + elements[elements.size()-1];
  776 +
  777 + // Strip any ".gz"
  778 + outname = gammalib::strip_chars(outname, ".gz");
775 779  
776 780 // Return output filename
777 781 return outname;
... ...
src/ctselect/ctselect.cpp
... ... @@ -846,9 +846,10 @@ std::string ctselect::check_infile(const std::string& filename) const
846 846 *
847 847 * @param[in] filename Input file name.
848 848 *
849   - * This converts an input filename into an output filename by prepending a
850   - * prefix to the input filename. Any path will be stripped from the input
851   - * filename.
  849 + * Converts an input filename into an output filename by prepending the
  850 + * prefix stored in the member m_prefix to the input filename. Any path will
  851 + * be stripped from the input filename. Also a trailing ".gz" will be
  852 + * stripped.
852 853 ***************************************************************************/
853 854 std::string ctselect::set_outfile_name(const std::string& filename) const
854 855 {
... ... @@ -857,6 +858,9 @@ std::string ctselect::set_outfile_name(const std::string& filename) const
857 858  
858 859 // The last path element is the filename
859 860 std::string outname = m_prefix + elements[elements.size()-1];
  861 +
  862 + // Strip any ".gz"
  863 + outname = gammalib::strip_chars(outname, ".gz");
860 864  
861 865 // Return output filename
862 866 return outname;
... ...