Commit e9252cfb1ce8f769dfd89cfc751d60c33b56fbc3

Authored by Jürgen Knödlseder
1 parent de0c6506

Remove usage of GFilename::c_str() GFits (the method does no longer exist).

Showing 1 changed file with 7 additions and 10 deletions
src/fits/GFits.cpp
... ... @@ -1013,12 +1013,6 @@ int GFits::extno(const std::string& extname) const
1013 1013 ***************************************************************************/
1014 1014 void GFits::open(const GFilename& filename, const bool& create)
1015 1015 {
1016   - // Remove any HDUs
1017   - m_hdu.clear();
1018   -
1019   - // Expand environment variables
1020   - //std::string fname(gammalib::expand_env(filename()));
1021   -
1022 1016 // Don't allow opening if a file is already open
1023 1017 if (m_fitsfile != NULL) {
1024 1018 std::string msg;
... ... @@ -1034,18 +1028,21 @@ void GFits::open(const GFilename& filename, const bool& create)
1034 1028 throw GException::invalid_argument(G_OPEN, msg);
1035 1029 }
1036 1030  
  1031 + // Remove any HDUs
  1032 + m_hdu.clear();
  1033 +
1037 1034 // Initialise FITS file as readwrite and non created
1038 1035 m_readwrite = true;
1039 1036 m_created = false;
1040 1037  
1041 1038 // Try opening FITS file with readwrite access
1042 1039 int status = 0;
1043   - status = __ffopen(FHANDLE(m_fitsfile), filename.c_str(), 1, &status);
  1040 + status = __ffopen(FHANDLE(m_fitsfile), filename.url().c_str(), 1, &status);
1044 1041  
1045 1042 // If failed then try opening as readonly
1046 1043 if (status == 104 || status == 112) {
1047 1044 status = 0;
1048   - status = __ffopen(FHANDLE(m_fitsfile), filename.c_str(), 0, &status);
  1045 + status = __ffopen(FHANDLE(m_fitsfile), filename.url().c_str(), 0, &status);
1049 1046 m_readwrite = false;
1050 1047 }
1051 1048  
... ... @@ -1053,7 +1050,7 @@ void GFits::open(const GFilename& filename, const bool& create)
1053 1050 // FITS file now
1054 1051 if (create && status == 104) {
1055 1052 status = 0;
1056   - status = __ffinit(FHANDLE(m_fitsfile), filename.c_str(), &status);
  1053 + status = __ffinit(FHANDLE(m_fitsfile), filename.url().c_str(), &status);
1057 1054 m_readwrite = true;
1058 1055 m_created = true;
1059 1056 }
... ... @@ -1241,7 +1238,7 @@ void GFits::saveto(const GFilename& filename, const bool& clobber)
1241 1238 // the file name does not contain the .gz extension.
1242 1239 if (clobber) {
1243 1240 if (gammalib::file_exists(filename)) {
1244   - std::remove(filename.c_str());
  1241 + std::remove(filename.url().c_str());
1245 1242 }
1246 1243 else {
1247 1244 if (gammalib::file_exists(gzfname)) {
... ...