Fix erroneous test for non writable folder, when trying to save a schematic file with no path in name.

(seems wxFileName.IsDirWritable() fails under Windows when the path is empty (does not use the CWD).)
This commit is contained in:
jean-pierre charras 2011-10-27 20:38:31 +02:00
parent 60805606a0
commit 858636fd27
1 changed files with 11 additions and 3 deletions

View File

@ -550,10 +550,18 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
msg.Printf( _( "You do not have write permissions to folder <%s>." ), msg.Printf( _( "You do not have write permissions to folder <%s>." ),
GetChars( aFileName.GetPath() ) ); GetChars( aFileName.GetPath() ) );
} }
else if( !aFileName.FileExists() && !aFileName.IsDirWritable() ) else if( !aFileName.FileExists() )
{ {
msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ), // Extract filename path, and if void, uses the CWD
GetChars( aFileName.GetFullName() ), GetChars( aFileName.GetPath() ) ); // because IsDirWritable does not like void path
wxString filedir = aFileName.GetPath();
if( filedir.IsEmpty() )
filedir = wxGetCwd();
if( !aFileName.IsDirWritable(filedir) )
{
msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ),
GetChars( aFileName.GetFullName() ), GetChars( filedir ) );
}
} }
else if( aFileName.FileExists() && !aFileName.IsFileWritable() ) else if( aFileName.FileExists() && !aFileName.IsFileWritable() )
{ {