Skip to content

Commit

Permalink
Use QFile to determine if a proposed filename already exists. It will…
Browse files Browse the repository at this point in the history
… allow or disallow names which differ only in case depending upon platform. Fix for #1044.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9287 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Sep 9, 2008
1 parent f67777f commit b312571
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions src/plugins/grass/qgsgrassnewmapset.cpp
Expand Up @@ -360,18 +360,10 @@ void QgsGrassNewMapset::checkLocation()
}
else
{
QDir d( mDatabaseLineEdit->text() );

for ( unsigned int i = 0; i < d.count(); i++ )
if ( QFile::exists( mDatabaseLineEdit->text() + "/" + location ) )
{
if ( d[i] == "." || d[i] == ".." ) continue;

if ( d[i] == location )
{
setNextEnabled( page( LOCATION ), false );
setError( mLocationErrorLabel, tr( "The location exists!" ) );
break;
}
setNextEnabled( page( LOCATION ), false );
setError( mLocationErrorLabel, tr( "The location exists!" ) );
}
}
}
Expand Down Expand Up @@ -1229,23 +1221,12 @@ void QgsGrassNewMapset::mapsetChanged()
// Check if exists
if ( mSelectLocationRadioButton->isChecked() )
{
bool exists = false;
QString locationPath = mDatabaseLineEdit->text() + "/" + mLocationComboBox->currentText();
QDir d( locationPath );

for ( unsigned int i = 0; i < d.count(); i++ )
if ( QFile::exists( locationPath + "/" + mapset ) )
{
if ( d[i] == "." || d[i] == ".." ) continue;

if ( d[i] == mapset )
{
setError( mMapsetErrorLabel, tr( "The mapset already exists" ) );
exists = true;
break;
}
setError( mMapsetErrorLabel, tr( "The mapset already exists" ) );
}

if ( !exists )
else
{
setNextEnabled( page( MAPSET ), true );
}
Expand Down

0 comments on commit b312571

Please sign in to comment.