Write through symlinks for schematics and PCBs

This commit is contained in:
Johannes Maibaum 2021-06-06 14:15:57 +02:00 committed by Jeff Young
parent 891e200fc8
commit 542c02046b
2 changed files with 24 additions and 0 deletions

View File

@ -109,6 +109,18 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
schematicFileName.SetExt( KiCadSchematicFileExtension );
}
#ifndef __WINDOWS__
// Write through symlinks, don't replace them
if( schematicFileName.Exists( wxFILE_EXISTS_SYMLINK ) )
{
char buffer[ PATH_MAX ];
char *realPath = realpath( TO_UTF8( schematicFileName.GetFullPath() ), buffer );
if( realPath )
schematicFileName.Assign( wxString::FromUTF8( realPath ) );
}
#endif
if( !IsWritable( schematicFileName ) )
return false;

View File

@ -943,6 +943,18 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
if( pcbFileName.GetExt() == LegacyPcbFileExtension )
pcbFileName.SetExt( KiCadPcbFileExtension );
#ifndef __WINDOWS__
// Write through symlinks, don't replace them
if( pcbFileName.Exists( wxFILE_EXISTS_SYMLINK ) )
{
char buffer[ PATH_MAX ];
char *realPath = realpath( TO_UTF8( pcbFileName.GetFullPath() ), buffer );
if( realPath )
pcbFileName.Assign( wxString::FromUTF8( realPath ) );
}
#endif
if( !IsWritable( pcbFileName ) )
{
wxString msg = wxString::Format( _( "No access rights to write to file \"%s\"" ),