Changeset 12344

Show
Ignore:
Timestamp:
10/06/07 00:12:37 (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
  • branches/1.4/gdal/frmts/hfa/hfaopen.cpp

    r12166 r12344  
    17601760    psInfo->poRoot = new HFAEntry( psInfo, "root", "root", NULL ); 
    17611761 
     1762/* -------------------------------------------------------------------- */ 
     1763/*      If an .ige or .rrd file exists with the same base name,         */ 
     1764/*      delete them.  (#1784)                                           */ 
     1765/* -------------------------------------------------------------------- */ 
     1766    CPLString osExtension = CPLGetExtension(pszFilename); 
     1767    if( !EQUAL(osExtension,"rrd") && !EQUAL(osExtension,"aux") ) 
     1768    { 
     1769        CPLString osPath = CPLGetPath( pszFilename ); 
     1770        CPLString osBasename = CPLGetBasename( pszFilename ); 
     1771        VSIStatBufL sStatBuf; 
     1772        CPLString osSupFile = CPLFormCIFilename( osPath, osBasename, "rrd" ); 
     1773 
     1774        if( VSIStatL( osSupFile, &sStatBuf ) == 0 ) 
     1775            VSIUnlink( osSupFile ); 
     1776 
     1777        osSupFile = CPLFormCIFilename( osPath, osBasename, "ige" ); 
     1778 
     1779        if( VSIStatL( osSupFile, &sStatBuf ) == 0 ) 
     1780            VSIUnlink( osSupFile ); 
     1781    } 
     1782 
    17621783    return psInfo; 
    17631784}