Changeset 12341

Show
Ignore:
Timestamp:
10/06/07 00:07:41 (1 year ago)
Author:
warmerdam
Message:

Ensure .ige and .rrd get cleaned up when creating new files (#1784)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/hfa/hfaopen.cpp

    r12165 r12341  
    17651765    psInfo->poRoot = new HFAEntry( psInfo, "root", "root", NULL ); 
    17661766 
     1767/* -------------------------------------------------------------------- */ 
     1768/*      If an .ige or .rrd file exists with the same base name,         */ 
     1769/*      delete them.  (#1784)                                           */ 
     1770/* -------------------------------------------------------------------- */ 
     1771    CPLString osExtension = CPLGetExtension(pszFilename); 
     1772    if( !EQUAL(osExtension,"rrd") && !EQUAL(osExtension,"aux") ) 
     1773    { 
     1774        CPLString osPath = CPLGetPath( pszFilename ); 
     1775        CPLString osBasename = CPLGetBasename( pszFilename ); 
     1776        VSIStatBufL sStatBuf; 
     1777        CPLString osSupFile = CPLFormCIFilename( osPath, osBasename, "rrd" ); 
     1778 
     1779        if( VSIStatL( osSupFile, &sStatBuf ) == 0 ) 
     1780            VSIUnlink( osSupFile ); 
     1781 
     1782        osSupFile = CPLFormCIFilename( osPath, osBasename, "ige" ); 
     1783 
     1784        if( VSIStatL( osSupFile, &sStatBuf ) == 0 ) 
     1785            VSIUnlink( osSupFile ); 
     1786    } 
     1787 
    17671788    return psInfo; 
    17681789}