Add user write permission tests to EESchama and other minor fixes.
* Add general purpose user write permission test function to base window class. * Check user write permissions before saving project, schematic and library files. * Remove displaying file dialog every time the project file is saved. * Display absolute paths for non-root sheet file in title bar. * Remove redundant command table entry from schematic editor. * Remove unused variables to fix GCC 4.6 warnings. * The usual Doxygen comment and coding style policy fixes.
This commit is contained in:
@@ -445,3 +445,35 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
|
||||
wxTheClipboard->SetData( new wxTextDataObject( tmp ) );
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
||||
|
||||
bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
wxCHECK_MSG( aFileName.IsOk(), false, wxT( "Invalid file name object. Bad programmer!" ) );
|
||||
|
||||
if( aFileName.IsDir() && !aFileName.IsDirWritable() )
|
||||
{
|
||||
msg.Printf( _( "You do not have write permissions to folder <%s>." ),
|
||||
GetChars( aFileName.GetPath() ) );
|
||||
}
|
||||
else if( !aFileName.FileExists() && !aFileName.IsDirWritable() )
|
||||
{
|
||||
msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ),
|
||||
GetChars( aFileName.GetFullName() ), GetChars( aFileName.GetPath() ) );
|
||||
}
|
||||
else if( aFileName.FileExists() && !aFileName.IsFileWritable() )
|
||||
{
|
||||
msg.Printf( _( "You do not have write permissions to save file <%s>." ),
|
||||
GetChars( aFileName.GetFullPath() ) );
|
||||
}
|
||||
|
||||
if( !msg.IsEmpty() )
|
||||
{
|
||||
DisplayError( this, msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user